So i followed a splendid and extremely complicated tutorial on creating a carousel using an xml file. I don't know what happened but my swf is messed up to high heck. I hope someone can help me before my brain explodes. Here's the AS.
import mx.utils.Delegate;
var numOfItems:Number;
var radiusX:Number = 200;
var radiusY:Number = 50;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
var speed:Number = 0.05;
var perspective:Number = 130;
var tooltip:MovieClip = this.attachMovie("tooltip", "tooltip", 10000);
var home:MovieClip = this;
tooltip._alpha = 0;
var xml:XML = new XML();
xml.ignoreWhite = true;
xml.onLoad = function() {
var nodes = this.firstChild.childNodes;
numOfItems = nodes.length;
for (var i = 0; i<numOfItems; i++) {
var t = home.attachMovie("Item", "Item"+i, i+1);
t.angle = i*((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes[i].attributes.tooltip;
t.icon.inner.loadMovie(nodes[i].attributes.image);
t.ref.inner.loadMovie(nodes[i].attributes.image);
t.icon.onRollOver = over;
t.icon.onRollOut = out;
t.icon.onRelease = released;
}
};
function over() {
home.tooltip.tipText.text = this._parent.toolText;
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y-this._parent._height/2;
home.tooltip.onEnterFrame = Delegate.create(this, moveTip);
home.tooltip._alpha = 100;
}
function out() {
delete home.tooltip.onEnterFrame;
home.tooltip._alpha = 0;
}
function released() {
trace(this._parent.toolText);
}
function moveTip() {
home.tooltip._x = this._parent._x;
home.tooltip._y = this._parent._y-this._parent._height/2;
}
xml.load("icons.xml");
function mover() {
this._x = Math.cos(this.angle)*radiusX+centerX;
this._y = Math.sin(this.angle)*radiusY+centerY;
var s:Number = (this._y-perspactive)/(centerY+radiusY-perspective);
this._xscale = this._yscale=s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale)+100);
}
// speed
this.onMouseMove = function() {
speed = (this._xmouse-centerX)/2500;
};
Check out the swf to see if you might figure this out. The fla is in there too. Any help would be extremely appreciated.