vendredi 16 septembre 2016

AS3: How do I get dynamic loader URL from LoaderInfo in Event Listener Function?

I'm loading many pictures, and am using an array to do so.

loader[i].load(new URLRequest(picture[i]));

My Event Listener function is enabled like this:

loader[i].contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);   

My onComplete event handler shows this:

trace(e.target); //OUTPUT: [object LoaderInfo]

I've looked for properties in LoaderInfo that might identify which loader initiated the listener (the value of "i") so that I can putz around with each one specifically, like this:

bitmapDataArr[i] = e.target.content.bitmapData;
bmVisArr[i] = new Bitmap(bitmapDataArr[i]);

But cannot determine which "i" initiated the specific instance of the listener.

Any ideas? I tried giving a name to LoaderInfo to no avail. I still can't extract the pesky little identifying number.

Aucun commentaire:

Enregistrer un commentaire