4.4. Working with Layers
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).
4.4.1. Renaming Layers
The names that Flash gives the layers you createLayer 1, Layer 2, Layer 3, and so onaren'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.
| UP TO SPEED |
Flash gives you two different ways to change the properties associated with your layers: for example, the name of your layer, whether you want to show the content of a layer on the Stage or hide it, whether you want to lock a layer or leave it editable, and so on.
One way is clicking the icons in the Layers window. (That's the approach described in this chapter.) The other way is by using the Layer Properties dialog box.
To display the Layer Properties dialog box, click to select a layer; then do one of the following:
The Layer Properties dialog box lets you change any or all of the following layer properties in one fell swoop:
After you make your changes, click OK to tell Flash to apply your changes to your layer.
Click inside the text box and then type birds ; then click anywhere else in the workspace .
Flash displays the new name for your layer.
Repeat steps 1 and 2 for Layers 3, 2, and 1, renaming them cloud, flowers , and fence , respectively .
Earlier in this chapter, you saw how to copy and paste individual series of frames . But Flash also lets you copy and paste entire layersuseful 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 rightperhaps 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.
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 thenwithout letting up on your mousedrag 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).
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.