cant display log images
I am loading a series of images that animate a sinking log. The log sinks down in water and then rises back up so I display 3 images to sink and the same images in reverse so it rises again and repeated continually.
What I get is the images being displayed in some weird order and not in the order as in urls16?
I cant display these images in the order given below?
I dont get any error.
private var urls16:Array = ["images/logW1.png", "images/logW2.png", "images/logW3.png", "images/logW3.png", "images/logW2.png", "images/logW1.png"];
var en4:ClassEnemylog
en4=
new ClassEnemylog(urls16,1,6,300,256,480,0,2,96,32,10);
en4.addEventListener(
"image_loaded",imageLoadedHandler);
canvas1.addChild(en4);
myEnemyList12.push(en4);
/////
for each (var el:String in urls) {
var loader:Loader = new Loader;
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded);
loader.load(
new URLRequest(el));
}
private function imageLoaded(event:Event):void
{
var Singleimage:Bitmap = new Bitmap(event.target.content.bitmapData);
var bmd=Singleimage.bitmapData;
MyBData.push(bmd);
...
///////////////////// where it animates
public function moveLeft():void
{
if (_x<_endX -100 )
{
_x=_startX;
}
//_x-=_speed;
timej+=1;
if (timej>=32)
{
i=i + 1;
if (i>=_noFrames)
{i=0;}
img1.bitmapData=MyBData; ///////////////this is the issue
trace("in animate=" + i + " timej=" + timej + " _noFrames=" + _noFrames + "length=" +MyBData.length);
timej=0;
}
img1.x=_x;
}