Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Working with Movie Clips > About caching and scrolling movie clips with ActionScript > Setting the background of a movie clip | |||
You can set an opaque background for a movie clip. For example, when you have a background that contains complex vector art, you can set the opaqueBackground property to a specified color (typically the same color as the Stage). The background is then treated as a bitmap, which helps optimize performance.
When you set cacheAsBitmap to true, and also set the opaqueBackground property to a specified color, the opaqueBackground property allows the internal bitmap to be opaque and rendered faster. If you do not set cacheAsBitmap to true, the opaqueBackground property adds an opaque vector-square shape to the background of the movie clip instance. It does not create a bitmap automatically.
The following example shows how to set the background of a movie clip to optimize performance.
To set the background of a movie clip: /* When you set cacheAsBitmap, the internal bitmap is opaque and renders faster. */ my_mc.cacheAsBitmap = true; my_mc.opaqueBackground = 0xFF0000;
The movie clip appears on the Stage with the background color that you specified.
For more information on this property, see opaqueBackground (MovieClip.opaqueBackground property) in the ActionScript 2.0 Language Reference.
|
|
|
|