Here's an example using the class above, just using some images from a google
search.
When the 3rd image in the original sequence is loaded you will see the message
[b]the first 3 images have fully loaded[/b] in the output window.
You can also change the line
myImagesLoader.loadClips(3); //this limits simultaneous loading to 3
to
myImagesLoader.loadClips(1); //this limits simultaneous loading to 1 to force
sequential loading
Like I said its not completely finished but I believe its functional for what
you want/need. I'll post updates when I give it more attention to finish the
other features outlined in the comments.
import MultiLoader;
//quick google search for sample images
var images = [
"
http://docs.gimp.org/images/filters/examples/color-taj-sample-colorize.jpg",
"
http://admin.hotkeys.com/template_images/1187693917/sample1.jpg",
"
http://toxics.usgs.gov/photo_gallery/photos/pesticides/HerbReconn/hr_grab_sampl e_lg.jpg",
"
http://www.isis.rl.ac.uk/UserSupport/images/tosca%20sample%20changer%20illustra
tion.jpg",
"
http://ael.gsfc.nasa.gov/images/mars/sampleFlow.jpg",
"
http://img.alibaba.com/photo/50461044/Lamp_House_for_Checking_Color_Sample_Use. jpg",
"
http://www.physics.purdue.edu/primelab/ion_source/rabbit_sample_changer/images/
tn/D2198_Sample_receiver_section.jpg"
]
var myImagesLoader:MultiLoader = new MultiLoader();
var myImageLoadListener:Object = new Object();
var myMultiLoaderListener:Object = new Object();
myImageLoadListener.onLoadInit = function(target_mc) {
trace('onLoadInit has occurred for '+target_mc);
}
myMultiLoaderListener.groupProgress = function(evtObj) {
trace('groupProgress has occurred :');
for (var detail in evtObj) trace(detail+"="+evtObj[detail]);
if (evtObj.queueProgress==3){
trace('the first 3 images have fully loaded')
//the others will continue to load, but you could start something now
}
}
myMultiLoaderListener.groupComplete = function(evtObj) {
trace('groupComplete has occurred :');
for (var detail in evtObj) trace(detail+"="+evtObj[detail]);
}
myImagesLoader.addEventListener("groupProgress",myMultiLoaderListener);
myImagesLoader.addEventListener("groupComplete",myMultiLoaderListener);
var holderClip =
this.createEmptyMovieClip("imagesHolder",this.getNextHighestDepth())
for (var i=0;i<images.length;i++) {
var newImageClip =
holderClip.createEmptyMovieClip("image"+i,holderClip.getNextHighestDepth())
//add the clip to the MultiLoader, with its listener for the onLoadInit event
myImagesLoader.addClip(images[i],newImageClip,myImageLoadListener)
}
myImagesLoader.loadClips(3); //this limits simultaneous loading to 3