-
1. Re: cacheAsBitmap question
jmp808 Oct 31, 2010 8:56 AM (in response to Applauz78)re: Queston 1:
cacheAsBitmap puts a bitmap version of display objects onto the GPU. Bitmaps are already pre-cached, so you only need to call cacheAsBitmap on items with vector components (eg if you do a graphics.drawCircle for instance, or you've drawn your character with the shape tools, as opposed to importing a JPG/PNG)
once the item is on the GPU (as a texture basically) the hardware can move the item around the screen quickly without reverting to the software renderer (which is slower). If you make any modifications to this cached item then it will need to go back to the software renderer. (Note however if you use cacheAsBitmapMatrix you can also use the hardware to scale, rotate and alpha the cached bitmap)
If you want an animated sprite you are best changing the bitmapData of display objects
this is discussed here
http://forums.adobe.com/thread/719648?tstart=300
http://forums.adobe.com/thread/729917?tstart=30
what I'm not completely sure about yet is what is the quickest way to animate individual sprites by changing their bitmapData property as somewhere it must be needing the software renderer
doing cacheAsBitmap on an animated movieclip itself isn't going to give you performance increase as it'd need to be recached on every frame, which is essentially pointless. Instead, use cacheAsBitmap to make bitmap versions of static vector objects. If it's a vector animation like I said pre-cache each frame to individual bitmaps then use the technique linked off the articles above (http://www.yeahbutisitflash.com/?p=986)
re: Question 2:
do all your caching in your initializaton routine before your game/app starts, then it wont affect your main loop
J

