Macromedia Flash - Advanced masking with action script

In this exercise, I will show you how to mask dragging with the action script code. How to create is very simple, follow the steps in this lesson sequentially!

Drag the circle below with the mouse!

Step 1

First, select the picture as the background for this exercise.

Step 2

Create a new flash file. Press Ctrl + J ( Document Properties ) and set the width and width (Hight) of the file to the width of the image. Select any background color and set the Frame rate of the file to 32 , then click OK .

Step 3

Select the file, go to Import > Import to stage (Shortcut: Ctrl + R ) and import it into the image you selected.

Step 4

While the image is still selected, go to the Align Panel ( Ctrl + K ) and follow these steps:

1. Make sure that the Align / Distribute to Stage button is selected,
2. Click the Align horizontal center button
3. Click the Align vertical center button

Macromedia Flash - Advanced masking with action script Picture 1

Step 5

While the image is still selected, press F8 key ( Convert to Symbol ) to convert the image into a Movie Clip.

Step 6

When the new Movie Clip is still selected, go to the Properties Panel below. On the left side of the Instance name field, enter the name of the Movie Clip. In this example will be photo .

Macromedia Flash - Advanced masking with action script Picture 2

Step 7

Create a new layer and name it mask . Use the Oval Tool (O) to draw a circle like the image below (hold Shift in the drawing process).

Macromedia Flash - Advanced masking with action script Picture 3

While the circle is still selected, press F8 key ( Convert to Symbol ) to convert this circle into a Movie Clip.

Figure 8

When the new made Movie Clip is still selected, go to the Properties Panel below the stage. In the left part, enter the name Movie Clip in the Instance name field, in this example enter the mask

Macromedia Flash - Advanced masking with action script Picture 4

Step 9

Create a new layer above the layer mask and name it action .

Step 10

Select the first frame of layer action, go to Action Script (F9) and enter the following code:

stop ();
photo.setMask (mask);
mask.onPress = function () {
startDrag (this);
}
mask.onRelease = function () {
stopDrag ();
}

Check the newly created product (Ctrl + Enter)

4 ★ | 1 Vote

May be interested

  • Macromedia Flash - Water bubble effectPhoto of Macromedia Flash - Water bubble effect
    carefully watching this detailed tutorial will know how to create an extremely unique and funny effect with water bubble images using motion guide.
  • Photoshop edit new imagesPhoto of Photoshop edit new images
    photoshop elements elements 7 and premier elements 7 are adobe's image processing software released on august 26 along with photoshop online storage.
  • Microsoft AutoCollage: art of mixing imagesPhoto of Microsoft AutoCollage: art of mixing images
    autocollage, the software capable of identifying special points on images such as human faces and mixing these images together, has been released by microsoft.
  • Macromedia Flash - Create Text running in bannerPhoto of Macromedia Flash - Create Text running in banner
    details of this article will guide how to create text running on extremely attractive banner. you can use this text to create in ads, slideshows or websites to stand out. through this article, you will also learn a few tips for creating dynamic flash letters for use for other purposes.
  • Macromedia Flash - Photo effects with soundPhoto of Macromedia Flash - Photo effects with sound
    this tutorial will show you how to create a visual effect with extremely vivid sound, with only a few flash tips and tricks implemented on flash 8.
  • Macromedia Flash - Product image advertising effectsPhoto of Macromedia Flash - Product image advertising effects
    in this article, we will show you how to create a product advertising effect in flash. you can use this effect when you need to introduce a new product launch or in banner ads. this effect does not need to use any action script code but only created with mask in flash.