I have some code where I am loading a few hundred images into an array in Flash. I am using XML to pass in the list then a Loader for each entry like this –
for (var i:int = 0; i < myXML.item.length(); i++) {
imgloaders[i] = new Loader();
imgloaders[i].load(new URLRequest(myXML.item[i].imageLocation));
imgloaders[i].contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
}
I want to perform some action once all of these have finished loading. The only way I can think of is to increment a count each time one finishes and have a Timer that checks if the count has reached the number of images I am loading.
There must be a better way than that surely – Can anyone help?
Thanks for your time.
I wrote a trivial class for this not long ago; feel free to use it if you wish.
(sorry for the messy indentation).
It’s used like this;