370
Working with Movie Clips
The following table contains brief descriptions of the new properties for movie clip instances:
These three properties are independent of each other, however, the
opaqueBackground
and
scrollRect
properties work best when an object is cached as a bitmap. You only see
performance benefits for the
opaqueBackground
and
scrollRect
properties when you set
cacheAsBitmap
to
true
.
To create a surface that’s also scrollable, you must set the
cacheAsBitmap
and
scrollRect
properties for the movie clip instance. Surfaces can nest within other surfaces. The surface
copies the bitmap onto its parent surface.
For information on alpha channel masking, which requires you to set the
cacheAsBitmap
property to
true
, see
“About alpha channel masking” on page 377
.
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.
Property
Description
cacheAsBitmap
Makes the movie clip instance cache a bitmap representation of itself.
Flash creates a surface object for the instance, which is a cached
bitmap instead of vector data. If you change the bounds of the movie
clip, the surface is recreated instead of resized. For more information
and an example, see
“Caching a movie clip” on page 373
.
opaqueBackground Lets you specify a background color for the opaque movie clip
instance. If you set this property to a numeric value, the movie clip
instance has an opaque (nontransparent) surface. An opaque bitmap
does not have an alpha channel (transparency), and renders faster. For
more information and an example, see
“Setting the background of a
movie clip” on page 375
.
scrollRect
Lets you quickly scroll movie clip content and have a window for
viewing larger content. The movie clip’s contents are cropped, and the
instance scrolls with a specified width, height, and scroll offsets. This
lets the user quickly scroll movie clip content and have a window that
displays larger content than the Stage area. Text fields and complex
content that you display in the instance can scroll faster because Flash
does not regenerate the entire movie clip vector data. For more
information and an example, see
scrollRect (MovieClip.scrollRect
property)
.
NO
TE
You cannot apply caching directly to text fields. You need to place text within a movie
clip to take advantage of this feature. For an example, see the sample file in
Flash install
directory
\Samples and Tutorials\Samples\ActionScript\FlashType.
Summary of Contents for FLASH 8-LEARNING ACTIONSCRIPT 2.0 IN FLASH
Page 1: ...Learning ActionScript 2 0 in Flash...
Page 8: ...8 Contents...
Page 18: ...18 Introduction...
Page 30: ...30 What s New in Flash 8 ActionScript...
Page 66: ...66 Writing and Editing ActionScript 2 0...
Page 328: ...328 Interfaces...
Page 350: ...350 Handling Events...
Page 590: ...590 Creating Interaction with ActionScript...
Page 710: ...710 Understanding Security...
Page 730: ...730 Debugging Applications...
Page 780: ...780 Deprecated Flash 4 operators...
Page 830: ...830 Index...