Working with Mask Layers

I l @ ve RuBoard

Working with Mask Layers

Mask layers are special layers that allow you to hide and show elements on underlying layers. Shapes on the Mask layer are holes that allow items on linked layers to show through.

To create a mask layer:

  1. Do one of the following:

    • To create a new layer, in the Timeline, click the Insert Layer button. Flash selects the new layer.

    • Select a layer that already exists.

      In general, you should create (or select) a layer directly above the layer containing content you want to mask, although you can always create the mask separately and link the masked layers to it later.

  2. From the Modify menu, choose Layer to display the Layer Properties dialog box.

  3. In the Type section, click Mask (Figure 5.37).

    Figure 5.37. Select Mask as the layer type in the Layer Properties dialog box to define a layer as a mask.

    graphics/05fig37.gif

    You can also rename the layer to identify it as a mask, if you want.

  4. Click OK.

    Flash turns the selected layer into a mask layer and places a mask icon before the layer name (Figure 5.38).

    Figure 5.38. The mask-layer icon imitates the masking effect with a dark mask shape over a checkerboard pattern.

    graphics/05fig38.gif

To link layers to the mask:

  1. In the Timeline, select a layer that contains content you want to mask.

  2. From the Modify menu, choose Layer to display the Layer Properties dialog box.

  3. In the Type section, click Masked.

    You can rename the layer to identify it as a masked layer, if you want.

  4. Click OK.

    Flash links the selected layer to the mask layer directly above it and places a masked icon before the name (Figure 5.39). Flash indents the icon and layer name to indicate that the mask above this layer controls it.

    Figure 5.39. Set the Masked layer type in the Layer Properties dialog box (top). The checkerboard pattern on the layer icon in the Timeline indicates that the layer is masked (bottom).

    graphics/05fig39.gif

  5. Repeat steps 1 through 4 to create more linked layers.

    One mask can affect many linked layers.

graphics/01icon02.gif Tips

  • To create new linked layers, in the Timeline, select the layer directly beneath the mask; then follow the steps for creating a new layer. To link existing layers to a mask layer quickly, simply drag them in the Timeline so that they sit directly below the mask itself or one of its linked layers.

  • Positioning a layer beneath a list of masked layers can be tricky. When you position a layer's preview line after the last layer in the masked set, you have the choice of adding the layer to the masked set or placing it at the main level of the Timeline. Use the preview line's subtle clues to place the layer where you want it. Position the layer directly beneath the last masked layer. To add the layer to the masked set, drag slightly to the right; the bump on the top of the preview bar moves over to the right. To add the layer to the main level of the Timeline drag slightly to the left; the bump follows suit.


To create the mask:

  1. Create one or more layers containing graphic elements you want to reveal only through a mask.

  2. Create a mask layer above your masked-content layers, and make sure that it's selected, visible, and unlocked.

    The layer should be highlighted in the Timeline, and the eye and padlock columns should contain bullets (not X or padlock icons).

  3. Use the paintbrush, oval, or rectangle tool to create one or more fill shapes (Figure 5.40).

    Figure 5.40. The content for the layers that the mask will reveal is just like any other content. You create the holes in the mask from filled shapes. All the mask elements must be on the same sublevel of the layer. In other words, you must either use only editable shapes or combine all your shapes into a single group or symbol.

    graphics/05fig40.gif

    Flash uses only fills to create the mask and ignores any lines on the mask layer. The mask may consist of several shapes on the mask layer, but they must all be on the same sublayer. (For more information on how sublayers within a layer work, see Chapter 4.)

    You can use several editable shapes, or you can create one group or symbol that contains all the shapes. If you combine editable shapes and a group or symbol, Flash uses just the editable shapes to create the mask. If you have two or more groups or symbols, Flash uses just the bottom-most group or symbol. (For more details on stacking order for groups and symbols, see Chapter 4.)

graphics/01icon02.gif Tip

  • To convert a particular layer into a mask and link the layer beneath it in one step, use the contextual layer menu. Control-click (Mac) or right-click (Windows) the layer you want to be the mask. From the pop-up contextual menu, choose Mask. Flash automatically defines the layer as a mask, links the layer beneath the selected layer to the mask, and locks both layers so that masking is in effect.


To see the mask's effect:

  1. Lock the mask layer and all linked layers.

    or

    Control-click (Mac) or right-click (Windows) a mask (or masked) layer.

  2. From the contextual menu, choose Show Masking (Figure 5.41).

    Figure 5.41. The Show Masking command in the contextual menu for layers locks all layers linked to the selected mask.

    graphics/05fig41.gif

    Flash automatically locks the mask layer and all the layers linked to it.

    In movie-editing mode, you must lock the mask layer and any masked layers beneath it to see the mask effect (Figure 5.42). You can see the effect without locking the layers in one of Flash's test modes (see Chapter 13).

    Figure 5.42. After defining the mask and masked layers, you must lock them to see the mask in effect in movie-editing mode.

    graphics/05fig42.gif

To edit a mask:

  1. In the Timeline, select the mask layer.

  2. Make sure that the layer is visible and unlocked.

  3. Use any of the techniques you learned in preceding chapters to create and edit fills.

graphics/01icon02.gif Tips

  • If you want to break the connection between a mask and its linked layers, you can simply redefine the layer type for the masked layer in the Layer Properties dialog box.

  • If you delete a mask layer, Flash redefines all the layers linked to it as normal layers.

  • Keep in mind that masks use processor power. Using too many masks can slow the frame rate in your final movie.


The Mystery of Masks

A mask layer is like a window envelope (the ones you get your bills in). There may be whole sheaves of papers covered with numbers inside that envelope, but the outside presents a blank white front with just a little window that lets you see the portion of the bill showing your name and address. The mask layer is the window envelope, and the linked, or masked, layers are the papers inside.

In Flash, you create the window in the envelope by drawing and painting on a mask layer. (As you'll learn in Chapter 11, you can animate that window to create special effects.) Any filled shape on the mask layer becomes a window in the final movie. That window reveals whatever lies on the linked (or masked) layers inside the envelope. Within that envelope, you can have several layers that act just like any other Flash layers.

Here's where it gets a bit tricky. Any areas of the envelope (the mask layer) that you leave blank hide the corresponding areas of all the layers inside the envelope (the masked layers). But the same blank areas of the envelope allow all unlinked layers outside and below the envelope to show through.

I l @ ve RuBoard


Macromedia Flash MX for Windows and Macintosh. Visual QuickStart Guide
Macromedia Flash MX 2004 for Windows and Macintosh (Visual QuickStart Guides)
ISBN: 0582851165
EAN: 2147483647
Year: 2002
Pages: 243

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net