Hi
I try to listen to complet event on a Loader ( an array of)
this code don’t work :
var arrayLoader:Array = new Array ;
var arrayRequest : Array = new Array ;
for ( var b = 0; b< 10; b ++){
var d :Loader = new Loader();
var e : URLRequest = new URLRequest(“http://www.bases-as3.fr/images/tannoy.gif“)
arrayLoader[b]= d;
arrayRequest[b] = e
arrayLoader[b].load(arrayRequest[b]);
arrayLoader[b].contentLoaderInfo.addEventListener(Event.COMPLETE,lise nEvent);}
function lisenEvent(e : Event){
var cible = arrayLoader.indexOf(e.target)
trace ( cible) // always tace -1
}
But if you write the same code § or quite the same) with URLloader with some diferences it woks and the number of the target is perfectely fired. But I want to load images so I have to use
Loader insted og URLLoader
|||
the target’s not the array. it’s the loaderInfo. use the loader property:
var cible=arrayLoader.indexOf(e.target.loader);
|||
Thanks kglad for these anwser
this is saving me hours of unproductive works
|||
you’re welcome.
Related posts:
Related posts brought to you by Yet Another Related Posts Plugin.