|
Flash CS4 Resources |
Scaling and caching symbolsAbout 9-slice scaling and movie clip symbols9-slice scaling allows you to specify how scaling is applied to specific areas of a movie clip. With 9-slice scaling, you can ensure that the movie clip looks correct when scaled. With normal scaling, Flash scales all parts of a movie clip equally, and in both the horizontal and vertical dimensions. For many movie clips, this equal scaling can make the clip’s graphics look strange, especially at the corners and edges of rectangular movie clips. This is often true of movie clips used as user interface elements, such as buttons. The movie clip is visually divided into nine sections with a grid-like overlay, and each of the nine areas is scaled independently. To maintain the visual integrity of the movie clip, corners are not scaled, while the remaining areas of the image are scaled (as opposed to being stretched) larger or smaller, as needed. When a movie clip symbol has 9-slice scaling applied, it appears in the Library panel preview with the guides displayed. If Enable Live Preview is turned on (Control > Enable Live Preview) when you scale instances of the movie clip on the Stage, you see the 9-slice scaling applied on the Stage. Note: 9-slice scaling cannot be applied to Graphic or Button symbols.
Bitmaps inside 9-slice enabled movie clips are scaled normally,
without 9-slice distortion, while the other movie clip contents
are scaled according to the 9-slice guides.
Note: 9-slice scaling is sometimes also referred to as “scale 9.”
A 9-slice-enabled movie clip can contain nested objects within it, but only certain types of objects inside the movie clip properly scale in the 9-slice manner. To make a movie clip with internal objects that also adhere to 9-slice scaling when the movie clip is scaled, those nested objects must be shapes, drawing objects, groups, or graphic symbols. ![]() A 9-slice-enabled symbol in the Library panel and scaled on
the Stage For video tutorials about 9-slice scaling, see: Edit movie clip symbols with 9-slice scalingBy default, slice guides are placed at 25% (or one-fourth) of the symbol’s width and height from the edge of the symbol. In symbol-editing mode, the slice guides appear as dotted lines superimposed on the symbol. The slice guides don’t snap when you drag them on the pasteboard. The guides do not appear when the symbol is on the Stage. You cannot edit 9-slice-enabled symbols
in place on the Stage. You must edit them in symbol-editing mode.
Note: Instances
made from a 9-slice-enabled movie clip symbol can be transformed, but
should not be edited. Editing these instances can have unpredictable
results.
For video tutorials about 9-slice scaling, see: Enable 9-slice scaling for an existing movie clip symbol
Edit a 9-slice-enabled movie clip symbol
Improving rendering performance with bitmap cachingRuntime bitmap caching lets you optimize playback performance by specifying that a static movie clip (for example, a background image) or button symbol be cached as a bitmap at runtime. By default, Flash Player redraws each vector item on the Stage in every frame. Caching a movie clip or button symbol as a bitmap prevents Flash Player from having to continually redraw the item, because the image is a bitmap and its position on the Stage does not change. This provides a significant improvement in playback performance. For example, when you create an animation with a complex background, create a movie clip containing all the items included in the background. Then select Cache as Bitmap for the background movie clip in the Property inspector. During playback, the background is rendered as a bitmap stored at the current screen depth. Flash Player draws the bitmap on the Stage quickly and only once, letting the animation play faster and more smoothly. Without bitmap caching, the animation might play back too slowly. Bitmap caching lets you use a movie clip and freeze it in place automatically. If a region changes, vector data updates the bitmap cache. This process minimizes the number of redraws that Flash Player must perform, and provides smoother, faster playback performance. Only use runtime bitmap caching on static, complex movie clips in which the position, but not the content, of the movie clip changes on each frame in an animation. The playback or runtime performance improvement from using runtime bitmap caching is only noticeable on complex-content movie clips. Runtime bitmap caching with simple movie clips does not enhance performance. For more information, see When to enable caching in Learning ActionScript 2.0 in Adobe Flash. Guy Watson has written a detailed article about using bitmap caching in the Flash Developer Center titled Using Bitmap Caching in Flash. The Optimizing animations and FLA files (7:24) (CS3) video tutorial also provides tips on using runtime bitmap caching. Note: You can only use the Use Runtime Bitmap Caching option for
movie clip and button symbols.
Under the following circumstances, a movie clip does not use a bitmap (even if Use Runtime Bitmap Caching is selected) but instead renders the movie clip or button symbol by using vector data:
Specify bitmap caching for a movie clip
|