Finally had time for an update! Here are the animated sprite classes that i've mention before, which are being used in my nearly finished game. I've done some basic testing and built the main base for my animation system (i'll extend it to animated tiles for backgrounds later). I couldn't find an animated bitmap class on the web for Actionscript 3 that i could use for my specific requirements - so i've made my own. Heres a quick run down of the features:

  • Simple XML animation format
  • Unlimited number of "states" to define different actions for each sprite
  • Each frame can be any size rectangle, located anywhere on the animation image (not just repeating rectangles like most systems)
  • Possiblity to have huge sprites (can use multiple images for a single sprite - only limited to 2880 bitmap size maximum per asset)
  • A frame can be located anywhere on the image and can reuse a frame multiple times in a single state aswell as across multiple states
  • Optional handle/hotspot for handling sprites instead of top left
  • Minimizes overdraw by specifying smallest rectangles not just fixed width & size for each frame (handy for bin packing images)
  • No loop, normal looping or ping-pong style animation looping
  • Play animation forwards or backwards
  • Start animation at any frame, and jump to any frame
  • Allows both animated sprites & bitmaps (sprite has a child bitmap)
  • Clone animatedBitmaps to save processing the XML file multiple times
  • FRAME_CHANGED and ANIMATION_COMPLETE events
  • Play animation once, loop animation infinitely or specify number of loops
  • Each frame can have a specific number of milliseconds delay, allowing fine control over complex animations
  • Sprite animation playback speed can be adjusted to slowdown or speedup the whole animation on the fly
  • Set current state by statename as well as index
  • Uses ENTER_FRAME instead of timers for animation update (useTimer option if you want to use timers for specific animations)
  • Stagelayer object to separate animated sprites/bitmaps into layers (needed for ENTER_FRAME and handy for collisions)
  • 4 Different Rendering methods for memory use vs speed (and for different requirements as one type doesn't fit all)
    • FRAME_BUFFER_REFERENCE (uses original bitmapData & scrollRect)
    • FRAME_BUFFER_OVERSIZED (uses a single growing bitmapData & copyPixels)
    • FRAME_BUFFER_CACHED (uses a seperate bitmapData for each frame & caches it when first generated with copyPixels)
    • FRAME_BUFFER_UNIQUE (uses a new bitmapData & copyPixels everytime the frame changes)
  • Uses frame time delta with smoothing for smoother animation (includes option to turn it off)