You can create Mask Layers to show and hide parts of your content in a Flash presentation.
A Mask works like a window blocking out everything but a certain area that you define. A mask controls the visible area in one ore more layers. 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 "Masked Layers" below it.
You can also animate a Mask to create great effects in your Flash presentation.

- 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, keep it simple.

Creating Masks

For creating a masking effect, you first crate a Mask Layer in the Timeline. Then you must have one (or more) linked Layer below it (dedfined as Masked).
Any layer can be converted into a mask layer, by right-clicking on its name, then choose the Mask option.
With this method, the Layer below it will automatically be converted into a "Masked Layer", and both will be locked, as shown in the image below.
Mask and Masked Layers

Here is another way to create a Mask Layer:
- Click on the name of a Layer to select it, then click Modify -> Timeline -> Layer Properties (or right-click and choose Properties). The Layer Properties window appears (shown in the picture below), click the Mask checkbox, and then click OK.
Properties Layer
The layer is converted into Mask Layer, without to be locked. The Layer below remains as it is (unaffected). For this layer to be linked to the Mask Layer above, it must be defined as a Masked Layer.
Click the layer name of the layer directly beneath the mask layer, then click Modify -> Timeline -> Layer Properties (or right-click and choose Properties) to open the Properties window. In this window enable the Masked checkbox, and then click OK.
- A mask layer only affects the linked layers beneath it, and you can include as many Masked Layers you want, by dragging the layer beneath the Mask Layer.

In the next example we animate a Mask Layer to create a masking effect.
  1. Open a new Flash document and import an image on the Stage (with File -> Import -> Import to Stage).
  2. Add a new Layer in the Timeline (with click Insert -> Timeline -> Layer) and convert it in "Mask" (right-click on the layer name, choose Properties, then in the "Layer Properties" window enable the Mask checkbox, and click OK).
  3. In this Mask Layer draw an oval (with the "Oval Tool") in the left side of the picture on the Stage. This oval will be the visible area.
  4. Convert the oval into Movie Clip Symbol (from Modify -> Convert to Symbol, choose "Movie Clip" type, and click OK).
  5. Right-click on Frame 40 in Layer 1, and choose Insert Keyframe.
    - With this, the Flash presentation will contain 40 Frames which display the picture.
  6. Now we'll create the animation for the Movie Clip instance (the oval) in the Mask Layer.
    - We'll make the oval shape to move continuously from left to right, changing also its size.
    Select the Frame 40 in the Mask Layer (Layer 2), right-click on this frame and choose Insert Frame, then click Insert -> Motion Tween.
  7. Right-click again on Frame 40 in Layer 2, and choose Insert Keyframe.
  8. Select the Frame 20 in Layer 2, move the oval to the right side of the picture, and increase its size (with the "Free Transform tool").
    Click on Frame 40 (in Layer 2) and use the "Free Transform tool" to increase the size of the oval.
  9. Right-click on the "Layer 1" name in the Timeline, and choose Properties. Then, in the "Layer Properties" window enable the Masked checkbox, and click OK.
    - The Layer 1 becomes a Masked Layer, linked to the Mask Layer above.
    Press Ctrl+Enter to view the result. Will appear a Flash presentation like this:
- In the presentation below you can watch the steps of this example.

Masking effect

- You can download the FLA file with this example from -> Masking effect.

You can use any filled shape as a mask. Flash ignores gradients and lines, it just deals with the fill area.
You can edit the Motion Tween used for Mask as any normal Motion Tween.
You can use any type of animation in the Mask Layer (frame-by-frame, Classic Tween, or Shape Tween).

An ideea for a Masking effect is to keep fixed the shape used for the visualisation area, and move the image in the Masked Layer.
Too much masking can affect performance in the Flash Player, especially when objects are animated.

- To convert a mask layer back to a normal layer, open the "Layer Properties" window and enable the Normal checkbox.
- To remove a mask layer entirely, select it and then click the Delete Layer icon.
- To remove a linked layer from a mask layer, select it, open the "Layer Properties" window and enable the Normal checkbox.

Daily Test with Code Example

Which tag adds an image in web page?
<div> <img> <span>
<img src="" width="191" height="63" alt="Courses-Web" />
Which of these CSS codes displays the text oblique?
font-style: italic; text-decoration: underline; font-weight: 500;
#id {
  font-style: italic;
Click on the jQuery function used to hide with animation a HTML element.
click() hide() show()
$(document).ready(function() {
  $(".a_class").click(function(){ $(this).hide("slow"); });
Click on the correctly defined function in PHP.
fname function() {} function fname() {} function $fname() {};
function fname($a, $b) {
  echo $a * $b;
Creating Mask Layers in Flash

Last accessed pages

  1. CSS Course - Free lessons (10629)
  2. Other Free Courses (2012)
  3. Node.js Move and Copy Directory (6821)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (100936)
  5. Contact page - CoursesWeb (36861)

Popular pages this month

  1. Making DIV Contents Scroll Horizontally, with multiple Div`s inside (2419)
  2. Contact page - CoursesWeb (2320)
  3. Tabs effect with CSS (2308)
  4. Courses Web: PHP-MySQL JavaScript Node.js Ajax HTML CSS (909)
  5. PHP getElementById and getElementsByTagName (859)