Page is a not externally linkable
- Code, Content, and Presentation
-- Flash and Shockwave
---- Problem loading images into Flash carousel via XML


galahad2 - 8:46 am on Apr 11, 2008 (gmt 0)


Okay, I inserted trace commands as follows in the script:

var numOfItems:Number; //don't declare yet as number of items will be read from XML
var radiusX:Number = 250;
var radiusY:Number = 75;
var centerX:Number = Stage.width/2;
var centerY:Number = Stage.height/2;
var speed:Number = 0.05;
var perspective:Number = 130; //skew the perspective so items further back are smaller
var home:MovieClip = this; //create variable to be used inside the XML for loop later as we can't use "this" inside that loop
var xml:XML = new XML();
xml.ignoreWhite = true;
trace(xml.ignoreWhite);
xml.onLoad = function()
{
var nodes = this.firstChild.childNodes; //i.e the XML file hierarchy
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.icon.inner.loadMovie (nodes[i].attributes.image); //load the image files
}
}
trace(t.icon.inner.loadMovie);
for (var i=0;i<numOfItems;i++)
{
var t = this.attachMovie("item","item"+i,i+1);
t.angle = i * ((Math.PI*2)/numOfItems);
t.onEnterFrame = mover;
}
trace(t.onEnterFrame);
xml.load("icons.xml");
trace(xml.load);
function mover ()
{
this._x = Math.cos(this.angle) * radiusX + centerX;
this._y = Math.sin(this.angle) * radiusY + centerY;
var s:Number = (this._y - perspective)/(centerY + radiusY - perspective); //add the new perspective variable to the calculation
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)/2000;
}
trace(this.onMouseMove);

But the output I got wasn't particularly helpful. Output was:

true
undefined
undefined
[type Function]
[type Function]

Any ideas?


Thread source:: http://www.webmasterworld.com/flash/3621143.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com