Masking

Introduction


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.



Adding a Mask Layer

Using a mask layer provides a simple way to selectively reveal portions of the layer or layers below it. Masking requires making one layer a mask layer and the layers below it masked layers.

You’ll use the rectangular shape on the Stage to mask part of the road graphic and animation so that the animation fits better on the Stage.


  1. On the Stage, with the Selection tool selected, click the rectangular shape below the road.
  2. Drag the shape straight up and align the left edge of the shape with the left edge of the road.
  3. Right-click (Windows) or Control-click (Macintosh) the Mask layer in the Timeline and select Mask from the context menu.

    The layer converts to a mask layer, indicated by a blue diamond-shaped icon. The layer immediately below the layer is linked to the mask layer. The masked layer’s name is indented, and its icon changes to a blue layer icon.

  4. In the Timeline, drag the Road layer to the Mask layer, placing it below the Car layer.

    The mask layer and the layers it masks are automatically locked.

  5. To view the mask effect, select Control > Test Movie.
  6. When you finish viewing the mask effect, close the SWF file window to return to your document.

Practice:

  1. Open a new Flash document and type your name with a large size on the stage.

  2. Then make a new layer, a make a circle with a diameter taller than your name.

  3. Make it a symbol and tween it across your name.

  4. Right click on the layer and check "Mask".


Taken from “Using mask layers” under Using Flash from Macromedia Flash Help.