Using mask layers

For spotlight effects and transitions, you can use a mask layer to create a hole through which underlying layers are visible. A mask item can be a filled shape, a type object, an instance of a graphic symbol, or a movie clip. You can group multiple layers together under a single mask layer to create sophisticated effects.

To create dynamic effects, you can animate a mask layer. For a filled shape used as a mask, you use shape tweening; for a type object, graphic instance, or movie clip, you use motion tweening. When using a movie clip instance as a mask, you can animate the mask along a motion path.

To create a mask layer, you place a mask item on the layer that you want to use as a mask. Instead of having a fill or stroke, the mask item acts as a window that reveals the area of linked layers that lie beneath it. The rest of the mask layer conceals everything except what shows through the mask item. A mask layer can contain only one mask item. You cannot have a mask layer inside a button, and you cannot apply a mask to another mask.

You can also use ActionScript to create a mask layer from a movie clip. A mask layer created with ActionScript can be applied only to another movie clip. See Using movie clips as masks.

This example uses a movie clip to mask another movie clip.

This example uses a movie clip to mask two movie clips, on two layers.

This example uses a movie clip to mask a movie clip that contains a mask.

To create a mask layer:

  1. Select or create a layer containing the objects to appear inside the mask.
  2. With the layer selected, select Insert > Timeline > Layer to create a new layer above it.

    A mask layer always masks the layer immediately below it, so be sure to create the mask layer in the proper place.

  3. Place a filled shape, text, or an instance of a symbol on the mask layer.

    Flash ignores bitmaps, gradients, transparency, colors, and line styles in a mask layer. Any filled area is completely transparent in the mask; any nonfilled area is opaque.

  4. Right-click (Windows) or Control-click (Macintosh) the mask layer's name in the Timeline, and select Mask from the context menu.

    The layer is converted to a mask layer, indicated by a mask layer icon. The layer immediately below it is linked to the mask layer, and its contents show through the filled area on the mask. The masked layer name is indented, and its icon changes to a masked layer icon.

  5. To display the mask effect in Flash, lock the mask layer and the masked layer.

To mask additional layers after creating a mask layer, do one of the following:

To unlink layers from a mask layer:

  1. Select the layer you want to unlink.
  2. Do one of the following:
    • Drag the layer above the mask layer.
    • Select Modify > Timeline > Layer Properties and select Normal.

To animate a filled shape, type object, or graphic symbol instance on a mask layer:

  1. Select the mask layer in the Timeline.
  2. Click in the Lock column to unlock the mask layer.
  3. Do one of the following:
    • If the mask object is a filled shape, apply shape tweening to the object as described in Tweening shapes.
    • If the mask object is a type object or graphic symbol instance, apply motion tweening to the object as described in Tweening instances, groups, and type.
  4. When you've completed the animation operation, click in the Lock column for the mask layer to lock the layer again.

To animate a movie clip on a mask layer:

  1. Select the mask layer in the Timeline.
  2. Double-click the movie clip on the Stage to edit the movie clip in place and to display the movie clip's Timeline.
  3. Apply motion tweening to the movie clip as described in Tweening instances, groups, and type. To animate the movie clip on a motion path, see Tweening motion along a path.
  4. When you've completed the animation procedure, click the Back button in the Edit in Place window to return to document-editing mode.
  5. Click in the Lock column for the mask layer to lock the layer again.