I’m having a bunch of trouble using a loader to populate an array. I’m trying to use one loader contained in a loop along with the push method. Is this possible to use a single loader or do I need to create an array of loaders as well. With the code I’m using now all the positions in the array end up showing the last SWF that I call.
Here’s the code:
for(var i:int=1; i <= 4; i++){
caseName = "case" + _caseCounter + ".swf";
trace(caseName);
_caseCounter++;
var panelLoader:Loader = new Loader();
panelLoader.load(new URLRequest("casefolder/" + caseName));
panelLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loaded, false, 0, true);
function loaded(evt:Event):void {
casePanel.push(panelLoader.content);
trace("pushed");
}
}