Hey everyone,
So I created a slideshow that worked in one website, now I'm trying to re-use the SAME EXACT CODE but it's not working - weird I know, but shit happens. I figured out the images are slightly too big, so it might be that some of the images are not being ready when it's their turn to go into the slideshow (the slideshow is being controlled by a 3 seconds timer). Hence I decided to use the famous BulkLoader library so it would help me load all of the images at once and then I could start the timer only after all images are ready. Unfortunately, I did not figure it out myself (even after checking the documentation which is somehow outdated I believe), I kept getting a blank stage with no errors at all. Anyway, here's my attempt:
private function loadSlideShow(e:Event):void {
xmlData = new XML(e.target.data);
imageList = new XMLList(xmlData.image);
var i;
for (i = 0; i < imageList.length(); i++) {
_loader.add(new URLRequest(imageList[i].@url), {type: "image", id: String(i)} );
}
_loader.addEventListener(BulkProgressEvent.COMPLETE, slidesLoaded);
_loader.addEventListener(BulkProgressEvent.PROGRESS, slideProgress);
_loader.start();
}
private function slideProgress(e:Event):void {
showLoading();
}
private function slidesLoaded(e:BulkProgressEvent):void {
var ldr:BulkLoader = e.target as BulkLoader;
var mc:Sprite = new Sprite();
var bm:Bitmap = ldr.getBitmap(String(_counter)) as Bitmap;
mc.addChild(bm);
_counter++;
slides.push(mc);
if(slides.length == imageList.length())
playSlideshow();
}
Suggestions? Thanks in advance!