1
votes

I'm doing an animation class in ActionScript 3 and would like to know the most efficient way to do it. Currently what I do is get an image (sprite sheet) and keep all the frames in an array of Bitmaps, then add each frame as a child and I put setVisible = false except the frame I have to show.

The other way I can think of is to have only one Bitmap added as a child and every time frame has to be changed, I copy the pixels to the Bitmap using copyPixels function.

There is somewhat more efficient than either of these alternatives?

Thanks

2

2 Answers

3
votes

Keep all your frames in a vector of BitmapData. Then use a single Bitmap and change it's bitmapData property when you want to change frames.

0
votes

Copypixels is quite fast.

There's an excellent comparison of rendering methods here at 8bitrocket.com; I would suggest giving it a read.