11. Creating Masks

Introduction

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.

Understanding Masks

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.

Understanding Masks
Understanding Masks

Understanding Masks

Creating a Mask Layer

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 Mask Layer

Create a Mask Layer 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.

Create a Mask Layer

Create a Mask Layer Click the Modify menu, point to Timeline, and then click Layer Properties.

Create a Mask Layer Click the Mask option from the Layer Type list.

Create a Mask Layer

Create a Mask Layer Click OK.

A blue masking icon appears on the layer.

Create a Mask Layer

Create a Mask 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.

Create a Mask Layer

Timesaver

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.

Timesaver

Drawing a Mask

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.

Create a Mask Layer

Create a Mask Layer Click to select the mask layer.

Create a Mask Layer

Create a Mask Layer If the mask layer is locked, click on the lock icon in the Lock Layer column to unlock it.

Create a Mask Layer 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.

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

Activate a Mask

Activate a Mask Open a document with a masked layer.

Activate a Mask Click the black dot in the lock column of the mask layer to lock it.

Activate a Mask

Activate a Mask Click this dot on each linked layer to lock all of them and see the masking effect.

Timesaver

You can click the Lock icon at the top of the lock layers column to lock all the layers in your Timeline simultaneously.

Timesaver

Editing a Mask

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.

Edit a Mask

Edit a Mask If the mask layer is locked, click on the lock icon in the Lock Layer column to unlock the layer and enable it for editing.

Edit a Mask

Edit a Mask Edit the shape of the mask or, if using a group or symbol, enter the group or symbol’s editing mode.

Edit a Mask Re-lock the mask layer and any linked layers to view changes.

Edit a Mask
Edit a Mask

Removing a Mask

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.

Remove a Mask

Remove a Mask Click on the mask layer to select it.

Remove a Mask

Remove a Mask Click the Modify menu, point to Timeline, and then click Layer Properties.

Remove a Mask Click the Normal option from the Layer Type list.

Remove a Mask

Remove a Mask Click OK.

The mask layer is converted into a normal layer.

Remove a Mask

Timesaver

Press Control+click (Mac) or right-click (Win) the Layer Name area of the mask layer you want to convert back into a normal layer, and then click Mask to deselect it.

Adding Layers to a Mask

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.

Link Additional Layers to a Mask

Link Additional Layers to a Mask To add additional layers to a mask, do one of the following:

a. Click and drag the layer below the mask.

b. Click and drag the layer until it touches the bottom of a layer already linked to the mask.

Link Additional Layers to a Mask
Link Additional Layers to a Mask
Link Additional Layers to a Mask
Link Additional Layers to a Mask

Did You Know?

You can change the order of the linked layers. Masked layers behave the same as other layers. Click and drag the layers to reorder them in the indented set.

Remove a Linked Layer from a Mask

Remove a Linked Layer from a Mask Click on the linked layer, and then drag it above the masked layer.

The layer will no longer be linked to the mask and the indentation disappears.

Remove a Linked Layer from a Mask
Remove a Linked Layer from a Mask
Remove a Linked Layer from a Mask

Animating a Mask Layer

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.

Animate a Mask

Animate a Mask Place artwork in a linked layer.

Animate a Mask

Animate a Mask Click on the first frame of the layer’s mask layer in the Timeline.

Animate a Mask 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.

Animate a Mask

Animate a Mask Select the first frame with the shape or symbol.

Animate a Mask Click the Insert menu, and then click Classic Tween (when using symbols) or Shape Tween (when using editable shapes).

Animate a Mask Click frame 12 in the Timeline.

Animate a Mask

Animate a Mask Click the Insert menu, point to Timeline, and then click Keyframe.

Timesaver

Press F6 to add a keyframe.

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

Timesaver Lock the mask layer and linked layer to see the effect.

Timesaver
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset