ok,
i’m trying to figure out how to replace loadMovie within a for loop where i’m populating dynamic movieclips.
I have:
/for (var i:uint = 0; i<finArray.length; i++)
{
var cubeFront:frontClip = new frontClip();
var cubeBack:backClip = new backClip();
var cF:MovieMaterial = new MovieMaterial(cubeFront, true, true, false);
cF.interactive=true;
var cB:MovieMaterial = new MovieMaterial(cubeBack, true, true, false);
cB.interactive=true;
//load image into clip
var imageLoader = new Loader();
var theURL:String = finArray*;
var imageRequest = new URLRequest(theURL);
imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
imageLoader.load(imageRequest);
function onComplete(evt:Event) {
trace("image"+ i +" loaded!");
cubeBack.holder.addChild(imageLoader.content);
imageLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE);
}
var mList:MaterialsList = new MaterialsList({front:cF, back:cB, left:clearSide, right:clearSide,
top:clearSide, bottom: clearSide});
var cube:Cube = new Cube(mList, 120, 1, 120, 1, 1, 1);
scene.addChild(cube);
//start cube in center
cube.x=0;
cube.y=0;
cube.z=0;
cube.alpha = 0;
var cPosX:Number = XposArray*;
var cPosY:Number = YposArray*;
trace("cPosX: "+cPosX);
trace("cPosY: "+cPosY);
Tweener.addTween(cube,{x: cPosX, y: cPosY, alpha: 1.0, transition:"easeInOutQuad",time:1.5});
cube.alpha = 1.0;
}
but it seems my URLRequest / Loader instances are being overwritten on each iteration of the loop (only the last image in the loop actually loads).
I thought maybe moving the declaration of the variables outside the loop as well as the onComplete function would work, but no go…