|
Free Open Book
Macromedia Flash 8 Bible |
Mask LayersIn the real world, a mask is used to selectively obscure items beneath it. In Flash, a Mask layer is used to define the visible area of layers nested beneath it. Multiple layers can be nested as masked layers beneath a single Mask layer. As with Motion guide layers, the content on Mask layers is not visible in the final .swf because it is intended only to modify how content in nested masked layers is rendered.
Almost any symbol or filled shape (excluding strokes) may be used to create a mask. However, Flash ignores bitmaps, gradients, transparency, colors, and line styles in a Mask layer. Masks may be animated or static. The only other limitations are that you cannot apply a mask to content in another Mask layer, and Mask layers cannot be placed within Button symbol timelines.
Masking with a Filled ShapeHere's how to create the simplest form of mask:
Figure 13-12: When the mask is active, the content on the Mask layer is no longer visible, but it will define the visible area of the content on the masked layer underneath.
Masking with a GroupMultiple filled shapes can also be grouped and used as a mask, as long as the Mask layer doesn't also contain primitive ungrouped shapes. Grouped shapes on the same layer as ungrouped shapes will be ignored when the Mask is applied. If a mask is composed of multiple items, using a group makes it easier to position the mask, as shown in Figure 13-14. Masking with a Symbol InstanceAs you are reminded in nearly every chapter of this book, working with symbols is working smart because doing so helps to reduce file size. Because symbols composed of filled shapes can be used as masks, there's no reason not to use a symbol from your Library to make a mask. (If you've already made a shape on your Mask layer, go ahead and convert it into a symbol so that you can use it again without adding to the final file size.) Reusing symbol instances to define masks is especially logical if you are making multiple masks that all have the same basic shape. For example, if you need a rectangular or oval mask, you will often find a symbol in your Library that was created to define the active area of a button or some other basic element. It is smarter to modify an instance of an existing symbol so that it works as a mask than to add redundant elements that increase your file size.
To illustrate the way that symbols can be reused as both graphic content and as mask elements, we have used instances of a symbol as static content on a masked layer and then Motion tweened another instance of the same symbol on a Mask layer to create an animated oval reveal. Figure 13-15 shows the symbol instance used on the Mask layer (on the left), the symbol instances used on the art layer (in the center), and the final mask effect visible when both layers are locked (on the right).
Masking TextNot only can text be masked, but it can also be used to mask other graphics. To mask text, simply set up your Mask and art layers, as we described in the previous section, with the text to be masked on the lower layer, and the filled item that you'll use for your aperture on the Mask layer, as shown in Figure 13-16.
Figure 13-16: Masking a text block with a tweened shape (shown on top) and the final reveal effect (shown on the bottom) To use text as a mask, the layers should be set up as described previously. In this situation, the text (which goes on the mask layer) will look as though it was filled by whatever is placed on the lower layer. For this to be effective, a larger point size and fuller, bold letterforms are best, as shown in Figure 13-17.
Because the edges of mask letterforms may be hard to discern if the image underneath is not a solid color, it can be helpful to add a drop-shadow to make the mask letters more legible. However, a drop-shadow or an outline added to the text on the Mask layer would not be visible, so it is necessary to copy the text onto a normal layer stacked above the Mask layer as follows:
Figure 13-18: Apply a Drop Shadow Filter with the Knockout option to the copy of your text to add more visual definition to the letter shapes.
|
Main Menu |
| 500 Juegos Gratis | 500 Giochi Gratis | 500 Jeux Gratuits | 500 Jogos Gratis | 500 Kostenlose Spiele |