Flash AS 3 Loader OnComplete Inside a Loop

Posted by meengla on Stack Overflow See other posts from Stack Overflow or by meengla
Published on 2010-05-05T20:29:58Z Indexed on 2010/05/05 20:58 UTC
Read the original article Hit count: 352

Filed under:
|
|
|
|

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

© Stack Overflow or respective owner

Related posts about flash

Related posts about event