Sunday, July 7, 2013

BulkImageLoader Class: A class to load images in sequence.



Previously in one of the project, I have a requirement for loading images in bulk(more images a time). But the sequence that I am loading images will not keep the same when bitmaps are adding on stage. So to load images in sequence I have created bulkimageloader class with custom events. Now I can control the loading of images in as sequence.

Click here to download zip file.

In fla file,
bulkImageLoader=new BulkImageLoader(imgReqArr) //pass the array of image path to BulkImageLoader class.
bulkImageLoader.addEventListener(BulkImageLoaderEvent.ALL_LOAD_COMPLETE,AllImgLoaded);
 //when all images will be loaded, this event will fire.you will get “e.paramArr[0]” array which cantain all bitmaps.
bulkImageLoader.addEventListener(BulkImageLoaderEvent.SINGLE_LOAD_COMPLETE,SingleImgLoaded);
 //when any single image will be loaded , this event will fire. You will get “e.paramId” i.e. index of bitamp in array and “e.paramBit” bitmap of that image.

Download zip file. 

Hope this helps someone.
Enjoy ActionScript...

No comments:

Post a Comment