You can create mask layers to show and hide parts of your artwork on the Stage. A mask works like a window blocking out everything but a certain area that you define. Any shape, symbol or text object can be used as a mask. The shape you place in a mask layer defines the area that will be visible in the linked layers below it. You can animate a mask to reveal the content on a layer in stages or animate the art in the layer beneath the mask. It is useful for spotlighting and controlling the shape of the viewable area. Masks are great tools for keeping the boundaries of the art on your Stage neat and controlled. They are also useful for cropping and experimenting with different borders and layouts, because you don’t have to edit your art, you simply edit the mask. When creating a mask layer, it is important not to mix elements. For example, don’t use an editable shape and a group on the same mask layer group everything together or break the groups into editable shapes. For the most consistent results, use ungrouped, editable shapes in the mask layer.
You use a mask in Flash to control what is viewable on a layer. Whatever you paint or draw onto a mask layer defines the viewable area on any layer it is linked to. Essentially, the shape you place on the mask layer acts like a window to the layers linked beneath it.
To link a layer, you simply drag it into the linked set. When a layer is linked to a mask it displays a tinted icon and is indented underneath the mask layer. Masks are useful for cropping artwork on the Stage, and animated masks can create interesting visual effects.
Any layer can be converted into a mask layer. A mask layer only affects the linked layers beneath it, and there is no limit to the number of layers that can be included. Once a mask layer is created, you can drag other layers beneath it to link them. It is important to keep in mind that too much masking can affect performance in the Flash Player, especially when objects in the masked layers or the mask itself are animated.
Create a new Layer in the Timeline or select an existing one.
The layer you select will be the one converted into a mask. If you want to mask the selected layer, create a new layer above this layer and select it.
Click the Modify menu, point to Timeline, and then click Layer Properties.
Click the Mask option from the Layer Type list.
Click OK.
A blue masking icon appears on the layer.
Click the layer name of the layer directly beneath the mask layer, and then drag the layer slightly up to link it to the mask.
Press Control+click (Mac) or right-click (Win) the Layer Name area of the layer you want to convert into a mask, and then click Mask. When you use this method, Flash converts the layer into a mask and then automatically links it to the layer directly beneath it.
You can use any filled shape as a mask. Flash ignores gradients, lines, and the content in bitmaps—in all cases it just deals with the whole shape. Use any of Flash’s drawing tools to create a shape that will define the viewable area of the linked layers below. Keep in mind that mixing elements at different levels (editable shapes and symbols, for example) can produce unexpected results. Try to use only one type of element in any one mask: editable shapes, symbols, or groups.
Click to select the mask layer.
If the mask layer is locked, click on the lock icon in the Lock Layer column to unlock it.
Draw a shape with any of Flash’s drawing tools or drag a symbol from the Library.
The area of the shape drawn, or symbol used, is the area that will be the visible area of the linked layer(s) beneath the layer mask.
To activate a mask, you simply lock it and any of the linked layers beneath it. Linked layers are indented in the Layer Name region and have tinted blue icons. You can lock and unlock a mask and its layers to edit them and see the effects of the mask in the Flash development environment. You can also use the Test Movie command to view the masking effects in the Flash Player.
Open a document with a masked layer.
Click the black dot in the lock column of the mask layer to lock it.
Click this dot on each linked layer to lock all of them and see the masking effect.
You can click the Lock icon at the top of the lock layers column to lock all the layers in your Timeline simultaneously.
Masks are editable. Which type of element you are using in the mask layer defines the procedure for editing: editable shapes can be modified with Flash’s drawing tools, while groups and symbols must be edited in their own editing modes. Regardless, Flash only concerns itself with the fill area. Changes to color, alpha, and other such attributes are ignored. To edit a mask, you must first unlock it. To view your changes, simply re-lock the mask layer and all of its linked layers.
To remove a mask layer entirely, select it and then click the Delete Layer icon. You can also convert a mask layer back to a normal layer in the Layer Properties dialog box. Additionally, you can remove linked layers from a mask layer set by dragging them out of the indented set.
Add layers to an existing mask by dragging them to any region within the masked layer hierarchy. Simply drag it between layers already linked, drag it under the mask layer, or drag it slightly up toward the bottom of a masked layer set. There is no limit to the number of layers that can be contained in a mask. Additionally, you can remove linked layers by dragging them out and above the mask layer set.
To create special effects such as a spotlighting effect or a gradual reveal of artwork on the Stage, you can animate a mask. Use any form of animation such as frame-by-frame animation or a shape or motion tween. The path of the shape or object on the mask layer will reveal the art below as it passes over it. Transforms to scale and position work well as well as shape tweens to editable objects. Other effects such as color and alpha will be ignored.
Place artwork in a linked layer.
Click on the first frame of the layer’s mask layer in the Timeline.
Do one of the following:
a. Draw a shape on the Stage with any of Flash’s drawing tools.
b. Drag an instance of a symbol from the Library.
Select the first frame with the shape or symbol.
Click the Insert menu, and then click Classic Tween (when using symbols) or Shape Tween (when using editable shapes).
Click frame 12 in the Timeline.
Click the Insert menu, point to Timeline, and then click Keyframe.
Transform the object with any of Flash’s editing procedures: scale, skew, position, or in the case of shape tweening, edit the shape of the object.
Lock the mask layer and linked layer to see the effect.