Flash AS 3 Loader OnComplete Inside a Loop
- by meengla
Hi,
I think I posted my question as an answer elsewhere
(http://stackoverflow.com/questions/2338317/how-to-get-associated-urlrequest-from-event-complete-fired-by-urlloader/2776515#2776515)
. Sorry. Here is my question again:
Hi, How can I make your function work for loader object in a loop? Thanks! Meengla Here is my existing (rough) code; I always get the mylabel from the last element of the array.
var _loader = new Loader();
for (j = 0; j < 5; j++) {
//mylabel variable is correct setup in the loop
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(e:Event):void {
doneLoad(e, mylabel);
});
_loader.load(new URLRequest(encodeURI(recAC[j].url)));
}//for loop