1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| stop();
var folder:String = "http://64.76.190.172/ntg/ca/carrusel/carrusel_imgs/"; // carpeta de imagenes y el archivo XML
var total:Number;
var radiusX:Number = 480;
var radiusY:Number = 300;
var centerX:Number = 387;
var centerY:Number = 150; // no variar por legibilidad del titulo
var speed:Number = 0.005;
var timeoutID:Number;
var intervalID:Number;
tn_group_mc._visible = false;
fm_label.text = ""; fm_url.text = "";
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes;
total = nodes.length;
for( var i=0; i < total; i++)
{
var t = tn_group_mc.duplicateMovieClip("tn"+i, i);
t.angle = i * ((Math.PI*2)/total);
t.onEnterFrame = mover;
t.tn_mc.inner.loadMovie( folder + nodes[i].attributes.filename );
t.tn_reflection_mc.inner.loadMovie( folder + nodes[i].attributes.filename );
t.fm_label = nodes[i].attributes.label;
t.fm_url = nodes[i].attributes.url;
t.fm_button.onRollOver = function()
{
fm_label.text = "Ir a " + this._parent.fm_label;
fm_url.text = "URL: " + this._parent.fm_url;
}
t.fm_button.onRollOut = function()
{
fm_label.text = "";
fm_url.text = "";
}
t.fm_button.onRelease = function()
{
getURL(this._parent.fm_url, _blank);
}
}
}
xml.load( folder + "edit.xml");
function mover()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s = this._y /(centerY+radiusY);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}
this.onMouseMove = function(){
clearInterval(intervalID);
clearTimeout(timeoutID);
speed = (this._xmouse-centerX) * 0.0001;
setTimeout(inactive, 30);
}
//If the move doesn't move for 2secs, this function is called
function inactive():Void
{
clearInterval(intervalID);
intervalID = setInterval(decreaseVelocity, 0.001);
}
//Each 100ms the speed is decreased 0.5 until zero
function decreaseVelocity():Void
{
if(speed>0)
{
speed -= 0.001;
}else
{
clearInterval(intervalID);
speed = 0;
}
} |
Partager