HELP!!!
New to Flash.
I’m trying to load 3 pictures into 3 movieclips.
The code below gives the result of only showing the 3rd image in mc3_mc.
According to the traces I’m using, 3 files are being loaded but it seems that my Event.COMPLETE statement is not doing it’s job?!?!
It seems that the first 2 times addChild is reached the file has not finished loading or the next one has already started to load so addChild doesn’t add anything.
Only the final iteration gets shown because there is no ‘next file’ to get in it’s way.
Any help would be greatly appreciated.
Code follows:
var numofiles:int=2;
var counter:Number=0;
var movieIndex:int;
var fileName:String;
var horzLoader:Loader = new Loader();
var myArray:Array=new Array(mc1_mc,mc2_mc,mc3_mc);
var animalArray:Array = new Array(
“Banco.jpg”,“Gargoyle-Trio.jpg”,“Triple Crossed.jpg”,"_DSC7875_Winter_CoatFF.jpg");
////////////////////////////////////
function load1(fileName):void {
horzLoader.load(new URLRequest("Thumbs/"+fileName));
trace(fileName);///////////////////////////
horzLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,horzLoaded);
}
function horzLoaded(e:Event):void {
myArray[counter].addChild(horzLoader);
trace("counter = "+counter);//////////////////////////
if (counter<numofiles) {
counter++;
load1(animalArray[counter]);
}
}
load1(animalArray[0]);