but for frame by frame animation (ie: one bitmap per frame), the method Zeh
said is the fastest... all bitmaps on stage, visible=true or visible=false
var currentFrame:int = 0;
var bitmaps:Array = [ ... push the bitmap instances into this array ... ];
function enterFrameLoop (e:Event):void {
animateBitmaps();
currentFrame++;
if (currentFrame >= 20) {
// loop play
currentFrame = 0;
}
}
function animateBitmaps ():void {
var i:int = 0;
var iLen:int = 20;
for (i; i<iLen; i++) {
bitmaps[i].visible = false;
}
bitmaps[currentFrame].visible = true;
}
addEventListener(Event.ENTER_FRAME, enterFrameLoop);
cedric
> allandt bik-elliott (thefieldcomic.com) skriver:
>> i was always under the impression that the best way of doing that (for games
>> sprite animations for instance) is bitmap 'blitting' where you use a
>> tilesheet and then use bitmap draw to pull the current frame you want to
>> show into your actual sprite
>
> I think that's not the fastest way. It's still copying the pixels. I am
> fairly sure that not copying the pixels is infinitely faster.
>
> My money is on the one Bitmap/multiple BitmapData solution. It should be
> using the least amount of memory and have no data copying at all.
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders