Sascha over at hexagonstar aka h1dd3n.r350urc3 has created a very cool AS3 Animated Bitmap Class. You might be asking, why would you need this, you already have movieclip animation and time-based animation? Well when making games sometimes you want to lock in a certain framerate or create assets/sprites (in the classical sense) you know will be pixel based that you need to lock their framerate say at 24 while the flash application can run much faster when you need to base off frame-based animation or enterframe situations as your game tick().
In game development sometimes the platform outspeeds the designed activity such as back in the day when the “turbo” button appeared on the 33MHz computers from 16MHz. DOS games built without this knowledge were unplayable because they were so fast. Flash with AS3 is all about performance and speed and at some point controlling that for a pixel based 2d game or iso game might be necessary if you need the rest of the SWF to run faster. You can also do time based animation rather than frame-based animation but there are always times when this could
This class helps situations when you have to have an animated bitmap sequence but don’t want to include all the files for each frame, rather you put them all in one and the SWF export is much smaller and this is always good.
You can download the class including demo source code and demo image here.
Be sure to head on over to hexagonstar and h1dd3n.r350urc3 because there is a sample there and also a photoshop CS script to help create these and adds a nice little capability to any game development pipeline.
What are the advantages over using a generic MovieClip? When writing games you might have several animated graphics (also called sprites, but not related to the AS3 Sprite class) that should run with a different framerate than the game’s global framerate. Let’s say your game runs with a global framerate of 99 and you put several animated sprites into your game that were created for playing back with a framerate of 24. With a MovieClip all those sprites would also play with a framerate of 99 which means they play way too fast. However with an AnimatedBitmap you can set every framerate individually. There are a couple of other advantages like that a Bitmap is more lightweight than a MovieClip and it has a isPlaying() method. Also it changes the way of how to embed assets. Instead of embedding many files for one animation only one image for a whole animation sequence is embedded which has positive effects on the file size. The ring sequence used in the demo has 21 frames that use 102Kb as single images but only 44Kb when they are combined to one image.
Thanks Sascha! Be sure to check out the other great old skool gaming tools that hexagonstar has come up with, good stuff like the hexagon framework.