3.8. Managing Content with Layers

Problem

You need to manage two elements independently of one another.

Solution

Place the elements in separate layers. Manage layers with layer folders.

Discussion

Layers are a common feature of graphics software that are generally used to control the stacking order of elements as well as facilitating asset management within files. Elements stored in layers higher in the stack will block elements in layers lower in the stack when there is overlap. By storing different elements in their own descriptively named layers, you can more readily manage the artwork by deleting, hiding, outlining, locking, and otherwise working with layer content independently of other layers. Although layers are used in Flash for both of these purposes, layers have additional significance:

  • Use layers to prevent overlapping Flash art from automatically cropping and blending with other art. (Another way to prevent this interaction is to group elements, as described in Recipe 3.16).

  • Use layers to animate elements differently.

The second point is the more significant of the two. All the contents of a layer are tied to its keyframes and frames. Certain types of content, such as Flash’s automated forms of animation, tweens, affect entire layers. If you want to animate two elements independently of one another, such as the eyes and mouth of a cartoon character, you must put these elements on different layers. In such an example, the eyes might blink every 45 frames, while the mouth is constantly ...

Get Flash 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.