Referencing Loader after created in Loop
I am creating a loop which loadsimages to newly created loaders. After each loader completes, I'd like to pass it through another function
Here's my loop of loaders where loader_names is an array of my loader names and overlay_files is an array of my file URLs
for (var j:int = 0; j < loader_names.length; j++) {
loader_names[j] = new Loader();
loader_names[j].contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader_names[j].load(new URLRequest(overlay_files[j]));
}
Once each image loads I want to overlay the image on a map here's a loop which does just that, only I do not know how to pass loaders into this function as they finish
function create_overlays(e:Event):void {
for (var k:int = 0; k < loader_names.length; k++) {
overlay_names[k] = new GroundOverlay(loader_names[k],
new LatLngBounds(new LatLng(46.669, -115.035), new LatLng(48.995,-112.079)开发者_如何学C));
}
}
Sorry if this is a bit messy, I am still learning. I am happy to clarify/simplify any of this..
thanks,
j
Edit, I misunderstood your issue.
In your create_overlays function you can refer to your loader by using the event that is passed in.
e.target
will refer you to the loader which fired the event.
精彩评论