I have a gallery where it will load an image after a previous image is loaded, so every time 'i' will +1 so that it could move to the next image. This code works fine on my other files, but I dunno why it doesn't work for the current file.
Normally if I trace 'i' the correct will be
0,1,2,3,4,5,6... etc
adding on till the limit, but this files its 'i' repeat the 1st number twice, only it continues to add
0,0,1,2,3,4,5,6...etc
The code is completely the same with the other file I'm using, but I don't know why it just doesn't work here. The code does not seems to have any problem. Anyway i can work around this situation?
private var i:uint=0;
private function loadItem():void {
if (i<myXMLList.length()) {
loadedPic=myXMLList[i].thumbnails;
galleryLoader = new Loader();
galleryLoader.load(new URLRequest(loadedPic));
galleryLoader.contentLoaderInfo.addEventListener(Event.COMPLETE,picLoaded);
} else {
adjustImage();
}
}
private function picLoaded(event:Event):void {
var bmp=new Bitmap(event.target.content.bitmapData);
bmp.smoothing=true;
bmpArray.push(bmp);
imagesArray[i].addChild(bmp);
i++;
loadItem();
}