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).

Renaming Layers

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 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.

To rename a layer:

  1. Open the file flowers.fla.

    If you created your own Flash document when you worked through "Adding Content to Multiple Layers" (Adding Content to Multiple Layers), you can use that document instead.

    When you open the Layer Properties box you've got all the layer settings in one place. You can change the layer name, show, hide, or lock your layer and much more.

    Figure 4-14. When you open the Layer Properties box you've got all the layer settings in one place. You can change the layer name, show, hide, or lock your layer and much more.

  2. Double-click the name Layer 4.

    Flash redisplays the layer name in an editable text box (Figure 4-15). On the Stage, you see the content for this layer (the birds) selected.

    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.

    Figure 4-15. 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.

    Note

    Instead of double-clicking the layer name, you can use the Layer Properties dialog box to rename your layer. Check out the box on Renaming Layers for details.

  3. Click inside the text box and then type birds; then click anywhere else in the workspace.

    Flash displays the new name for your layer.

  4. Repeat steps 1 and 2 for Layers 3, 2, and 1, renaming them cloud, flowers, and fence, respectively.

    When you're done, your renamed layers should look like Figure 4-16.

The Layers area of the Timeline isn't particularly big, so it's best to keep your layer names short and sweet. If you need more room, just click and drag the bar that separates the names from the frames.

Figure 4-16. The Layers area of the Timeline isn't particularly big, so it's best to keep your layer names short and sweet. If you need more room, just click and drag the bar that separates the names from the frames.

Copy and Paste a 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:

  1. 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.

  2. 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.

  3. 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.

Reordering (Moving) Layers

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-17 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 then—without letting up on your mouse—drag the layer to reposition it. Figure 4-18 shows you an example.

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.

Figure 4-17. 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.

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.

Figure 4-18. 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.

Delete a Layer

Flash gives you three different ways to delete a layer:

  • In the Timeline, right-click (on the Mac, Control-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-19).

    The quickest way to dispose of a layer is to select it and then click the Trash can. All Flash animations must contain at least one layer, so you can't delete the last layer. If you try, Flash doesn't display any error—it just quietly ignores you.

    Figure 4-19. The quickest way to dispose of a layer is to select it and then click the Trash can. All Flash animations must contain at least one layer, so you can't delete the last layer. If you try, Flash doesn't display any error—it just quietly ignores you.

  • 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.

Tip

If you delete the wrong layer by mistake, choose Edit → Undo Delete Layer.

Locking and Unlocking Layers

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-20) 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 slash through the pencil icon next to the layer's name as a visual reminder that you can't edit it.

    Here, the cloud and fence layers are unlocked, and the flowers layer (and the selected birds 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.

    Figure 4-20. Here, the cloud and fence layers are unlocked, and the flowers layer (and the selected birds 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.

  • To unlock a layer, click the Locked icon (the padlock in Figure 4-20) 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 (or unlock) 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.

Note

If you try to edit a locked layer, Flash displays a warning dialog box that gives you the opportunity to unlock (and then edit) the layer.

Get Flash CS3: The Missing Manual 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.