1 person found this helpful
check the cacheAsBitmap property of bitmaps to see if this will benefit performance in your app.
Actually, now that you mention it--it seems like the cacheAsBitmap flag was already set. I'll be sure to mark your response as the answer to this question. First though, I want to be sure I am clear of what is going on.
Here's my best assessment on why the vector tiles were rendering quicker than the raster tiles:
- Flash caches the draw data for tiles as a bitmap after drawing the first one--effectively performing the raster optimization I was trying to perform by rasterizing the asset itself.
- Every time the a tile is scaled (zooming) or an animated movie clip plays in front of a tile, that tile has to be redrawn as the vector version. However, the time savings of the rest of the cached tiles negates the performance decrease of these few vector tiles--yielding a net benefit from using the cached bitmaps
- Still unknown--why do my rasterized tiles not perform identically to my attempted raster version. Both have cacheAsBitmap on, so should behave almost exactly the same?
1 person found this helpful
cacheAsBitmap is a detriment to performance if the object is being scaled (or rotated or faded etc). cacheAsBitmap is a significant help if the object, at most, changes x,y properties. otherwise the bitmap must be redrawn.
Any ideas why having cacheAsBitmap on in both cases still ends up with the vector tiles rendering faster? My understanding of cacheAsBitmap is that it is a detriment to performance if the object is scaled, non-static, has a non-static asset in front of it in the same redraw region, etc. However, if it is on in both cases...shouldn't the two tests perform similarly? Right now, vector tiles draw 13% faster. Again, the only difference between both tests is that the movieclip in the vector version contains vector art vs. the movieclip in the raster version contains a png.
In fact, now that I think about it...shouldn't the raster version STILL outperform the vector version if both have cacheAsBitmap set?
Vector version - a redraw region is invalidated because of an animation or scale. Flash cannot use the cached version of the tile, so must redraw all vectors and maybe recache.
Raster version - a redraw region is invalidated because of an animation or scale. Flash cannot use the cached version of the tile, so must redraw a png and maybe recache.
I thought that when all things were the same, flash was more effecient at drawing a png vs a vector graphic?
Edit: Thanks again, by the way. I am sorry if I sound persistent--I just want to make sure that I truly understand what is going on under the hood.
in most situations you would expect any non-translational transform (ie, everything other than an x,y change) to demand less computer resources when applied to a vector vs a bitmap whether cacheAsBitmap is applied to both or applied to neither. you would expect each to use less resources during non-translational transforms when cacheAsBitmap is disabled.
Thanks for all the help