Question

i've developed an cross-platform AIR application, which seriously under performs on mobile devices caused by animating/using vector graphics instead of bitmap assets. employing cacheAsBitmapMatrix / cacheAsBitmap is better, when and where assigned appropriately, but still not as fast as using bitmap assets.

i've attempted to bitmapData.draw() the vector graphics to a Bitmap object at runtime and animate the bitmap object instead, but this performs only about as well as (or maybe even exactly the same as) simply caching the vector graphic as a bitmap.

Flash Professional 5.5 UI now has the ability to convert a vector graphic into a bitmap assets, but is it possible to do this at runtime? is it possible to have an actual Rasterize() routine to convert programatically drawn vector graphics and maybe even editable text into bitmaps at runtime for optimal animated performance, especially on mobile devices?

Was it helpful?

Solution

When you say that you tried animating the bitmap, I hope you didn't mean that you were rotating/resizing the bitmap - as that's a slow process.

Maybe have an engine that while your game is loading, creates a sprite sheet for you based on the frames in a MovieClip (if there's animation). Then these could be referenced by BitmapData.copyPixels().

This would simply:

  1. Create a BitmapData object.
  2. Draw each frame of the MovieClips timeline onto the BitmapData as you would manually with a sprite sheet.
  3. Store the BitmapData into an associative array for easy access later on, eg sheets["zombie1"]

You could even rotate your object in a for loop and draw the rotated object onto the sheet.

Then your SheetObject would just have methods for loading a portion of a previously defined sheet and displaying it.

Is this all on the right track..?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top