Cache
In the previous version of Flash if there is a large area, many, complex graphics in the film moving, often the phenomenon of movement is not smooth, now in Flash 8 added bitmap caching function to solve this problem!
When the MovieClip.cacheAsBitmap
or Button.cacheAsBitmap
property is set to true
, Flash Player caches the internal bitmap representation of the movie clip or button instance. This can improve the performance of movie clips that contain complex vector content. All the vector data for a movie clip with a cached bitmap is plotted in place instead of on the main stage.
Using ActionScript to implement bitmap caching has the following three properties:
cacheasbitmap: Makes the movie clip instance cache its own bitmap representation. Flash creates a surface object for this instance, which is a cached bitmap, not a vector data. If you want to change the range of a movie clip, the surface is rebuilt instead of readjusted.
opaquebackground: Enables you to specify the background color of an opaque movie clip instance. If you set this property to a numeric value, the movie clip instance will have an opaque (non-transparent) surface. Opaque bitmaps do not have Alpha channels (transparency) and can be rendered more quickly.
scrollrect: Enables you to quickly scroll through the contents of a movie clip and view larger content in one window. Cuts the contents of the movie clip, and the instance scrolls by the specified width, height, and scroll offset. This allows users to quickly scroll through the contents of the movie clip and use a window to display larger content than the "stage" area. Text fields and complex content that are displayed in an instance can scroll faster, because Flash does not need to regenerate the entire movie clip vector data.
Attention:
1. Opaquebackground and Scrollrect Two properties only have the best effect if the Cacheasbitmap property is set to true.
2. You cannot apply a cache directly to a text field using the Scrollrect property. You need to place text in a movie clip to take advantage of this feature.
3. It is a good idea to cacheAsBitmap
use a property with a movie clip that contains static content and is not frequently scaled and rotated.