i just implemented and created my own carousel effect. as you can see, the carousel there is centered on the window. i just adjusted via trial and error the code to center it. but if you will run the original carousel swf. the images via xml are not centered. here is the code
stop();
//carousel
var numOfItems:Number;
var radiusX:Number = 100;
var radiusY:Number = 50;
var centerX:Number = Stage.width / 6.5; - notice the values
var centerY:Number = Stage.height / 2.3; of these two??? trial and error:(
var speed:Number = 0.05;
var perspective:Number = 50;
var home:MovieClip = this;
var tooltip:MovieClip = this.attachMovie(“tooltip”,“tooltip”,10000);
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.PI2)/numOfItems);
t.onEnterFrame = mover;
t.toolText = nodes.attributes.tooltip;
t.icon.inner.loadMovie(nodes*.attributes.image);
t.r.inner.unloadMovie(nodes*.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 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 = (this._y - perspective) /(centerY+radiusY-perspective);
this._xscale = this._yscale = s*100;
this.angle += this._parent.speed;
this.swapDepths(Math.round(this._xscale) + 100);
}
this.onMouseMove = function()
{
speed = (this._xmouse-centerX)/2500;
}
the swf is external and preloaded dynmicaly. the moment the swf is loaded. the carousel is not centered and offscreen. i only adjusted it via trial and error. eventhough the display is now correct. can you tell me the problem why this occurs and the correct steps to be made.
and also, how can i apply onrelease event on the images loaded via external swf??