A SERVICE OF

logo

Macromedia MAX 2005 - Anaheim, CA What’s New In Flash 8
106
When to enable caching
Enabling caching for a movie clip creates a surface, which has several advantages, such as helping
complex vector animations to render fast. There are several scenarios in which you will want to
enable caching. It might seem as though you will always want to enable caching to improve the
performance of your SWF files; however, there are situations in which enabling caching does not
improve performance, or even decrease it. This section describes scenarios in which caching should
be used, and when to use regular movie clips.
Overall performance of cached data depends on how complex the vector data of your instances are,
how much of the data you change, and whether or not you set the opaqueBackground property. If
you are changing small regions, the difference between using a surface and using vector data could
be negligible. You might want to test both scenarios with your work before you deploy the
application.
When to use bitmap caching
The following are typical scenarios in which you might see significant benefits when you enable
bitmap caching.
Complex background image
An application that contains a detailed and complex background image of vector data
(perhaps an image where you applied the trace bitmap command, or artwork that you
created in Adobe Illustrator). You might animate characters over the background, which
slows the animation because the background needs to continuously regenerate the vector
data. To improve performance, you can select the content, store it in a movie clip, and set
the opaqueBackground property to true. The background is rendered as a bitmap and can be
redrawn quickly, so that your animation plays much faster.
Scrolling text field
An application that displays a large amount of text in a scrolling text field. You can place the
text field in a movie clip that you set as scrollable with scrolling bounds (the scrollRect
property). This enables fast pixel scrolling for the specified instance. When a user scrolls the
movie clip instance, Flash shifts the scrolled pixels up and generates the newly exposed
region instead of regenerating the entire text field.
Windowing system
An application with a complex system of overlapping windows. Each window can be open or
closed (for example, web browser windows). If you mark each window as a surface (set the
cacheAsBitmap property to true), each window is isolated and cached. Users can drag the
windows so that they overlap each other, and each window doesn't need to regenerate the
vector content.
All of these scenarios improve the responsiveness and interactivity of the application by
optimizing the vector graphics.
You can find a sample source file that shows you how bitmap caching can be applied to an
instance. Find the file called cacheBitmap.fla, in the Samples folder on your hard disk.
In Windows, browse to boot drive\Program Files\Macromedia\Flash 8\Samples and
Tutorials\Samples\ActionScript\CacheBitmap.
On the Macintosh, browse to Macintosh HD/Applications/Macromedia Flash
8/Samples and Tutorials/Samples/ActionScript/CacheBitmap.