The more layers you have, the more important it is to keep them organized. In this section, you see how to give your layers meaningful names, so that you can remember which images, sounds, or actions you placed in which layers. You also see how to order your layer so that your composite images appear just the way you want them and to copy and paste your layers (to cut down on the work you have to do to create similar layered effects).
The names that Flash gives the layers you create—Layer 1, Layer 2, Layer 3, and so on—aren't particularly useful when you've created 20 layers and can't remember which layer contains the ocean background you spent 10 hours drawing. Get into the habit of renaming your layers as soon you create them, and you'll have an easier time locating the specific elements you need when you need them.
This section builds on the example you created in "Adding Content to Multiple Layers" earlier in this chapter. If you haven't had a chance to work through that section, you can download flowers.fla from this book's "Missing CD" Web page and use it instead.
Figure 4-9. Top: This animation contains three layers: one containing a motion tween of a buzzing fly; one containing the path the fly takes as it buzzes around the frog's head; and one containing the highly interested frog. In some situations, showing all layers is fine, but here it's confusing to see all those images on the Stage at the same time. Bottom: Hiding the motion guide layer lets you focus on the two main elements of this animation: the frog and the fly.
To rename a layer:
Open the file flowers.fla.
If you created your own Flash document when you worked through "Adding Content to Multiple Layers" (Section 4.2), you can use that document instead.
Double-click the name Layer 4.
Flash redisplays the layer name in an editable text box (Figure 4-10). On the Stage, you see the content for this layer (the birds) selected.
Instead of double-clicking the layer name, you can use the Layer Properties dialog box to rename your layer. Check out the box on Section 4.4.1 for details.
Click inside the text box and then type birds; then click anywhere else in the workspace.
Flash displays the new name for your layer.
Figure 4-10. Top: The Layers area of the Timeline isn't particularly big, so make sure you keep your layer names short and sweet. (Even if you tell Flash to expand the layer, as described in the box on Section 4.4.1, the space for the layer name doesn't increase.) Bottom: If you can't remember what a particular layer contains, check the Stage: When you double-click a layer name to rename it, Flash automatically highlights the content associated with that layer.
Earlier in this chapter, you saw how to copy and paste individual series of frames. But Flash also lets you copy and paste entire layers—useful when you want to create a backup layer for safekeeping, or when you want to create a duplicate layer to change slightly from the original.
For example, if you want your animation to show an actor being pelted with tomatoes from different angles, you can create a layer that shows a tomato coming in from stage right—perhaps using a motion or shape tween (Chapter 3). Then you can copy that layer, paste it back into the Layers window, rename it, and tweak it so that the tomato comes from stage left. Maximum effect for minimum effort: That's what copying and pasting gives you.
To copy and paste a layer:
In the Layers window, click the name of the layer you want to select.
Flash highlights the layer name, as well as all the frames in the layer.
Select Edit → Timeline → Copy Frames.
If you don't have a layer waiting to accept the copied frames, create a new layer now before going on to the next step.
In the Layers window, select the name of the destination layer. Then choose Edit → Timeline → Paste Frames.
Flash pastes the copied frames onto the new layer, beginning with the first frame. It also pastes the name of the copied layer onto the new layer.
Flash always draws layers from the bottom up. For example, it displays the contents of the bottom layer first; then, on top of the bottom layer, it displays the contents of the next layer up; then, on top of both of those layers, it displays the contents of the third layer up; and so on. Figure 4-11 shows you an example.
Figure 4-11. Flash treats layers the same way you treat a stack of transparencies: The image on the bottom gets covered by the image above it, which gets covered by the image above it, and so on. Stacking isn't an issue if none of your images overlap. But when they do, you need to decide which layers you want in front and which behind. Here, for example, the cloud's covering up both the flowers and the fence, so it needs to be reordered.
Because Flash always displays layers from the bottom up, if you want to reorder your layers, you need to reorder their position in the layers list. Doing so is simple: All you have to do is click the name of a layer to select it and then—without letting up on your mouse—drag the layer to reposition it. Figure 4-12 shows you an example.
Flash gives you three different ways to delete a layer:
In the Layers window, right-click the layer you want to delete and then, from the shortcut menu that appears, choose Delete Layer.
Drag the layer you want to delete to the Trash can (see Figure 4-13).
Figure 4-12. Moving a layer is easy: Just click to select a layer and then drag it to reposition it (and change the order in which Flash displays the content of your frames). Here, the cloud layer has been moved to the bottom of the list, so it now appears behind the other images. The birds layer is in the process of being moved; you can tell by the thick gray line you see beneath the cursor.
Click the layer you want to delete to select it (or Shift-click to select several layers) and then click the Trash can.
Whichever method you choose, Flash immediately deletes the layer or layers (including all the frames associated with that layer or layers) from the Layers window.
Working with layers can be confusing, especially at first. So Flash lets you lock individual layers as a kind of safeguard, to keep yourself from accidentally changing content you didn't mean to change:
To lock a layer, click the Unlocked icon (the dot in Figure 4-14) next to the layer you want to lock. When you do, Flash turns the dot into a little padlock icon and deselects any objects that you'd selected on the Stage in that layer. If you locked the active layer, Flash draws a red slash through the pencil icon next to the layer's name as a visual reminder that you can't edit it.
To unlock a layer, click the Locked icon (the padlock you see in Figure 4-14) next to the layer you want to unlock. Instantly, the padlock turns into a dot, Flash reselects your objects, and you can edit them once again on the Stage.
To lock (or unlock) all of your layers all at once, click the Lock/Unlock All Layers icon. Click the icon again to return to unlocked (or locked) layers.
To lock all layers except the one you're currently editing, Alt+click (Windows) or Option-click (Mac) the unlocked icon next to the layer you're editing.
Figure 4-14. Here, the cloud and fence layers are unlocked, and the birds layer (and the selected flowers layer) are locked. Some people get into the habit of locking all the layers they're not currently editing. That way, they can't possibly add a shape or a tween to the wrong layer.