|
|
|
|
|
Date: 21.5.2009, 10:39 Total views: 11833
This, step by step, detailed action script lesson, will show you how to create mask dragging using the mouse cursor. You can use this lesson for some flash banner or some presentation. Using this lesson, You will also learn how to import any image into a flash stage, how to convert it into a Movie Clip Symbol, how to create instance name, how to convert any layer into a mask and much much more!
Example:
Step 1
First, find any image which you like to use for this lesson as background.
Step 2
Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your doucment as the dimensions of image. Select any color as background color. Set your Flash movie's frame rate to 22 and click ok.
Step 3
Call the current layer background. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!
Step 4
Choose now File > Import > Import to stage (Ctrl+R) and import any image into a flash stage. While the image is still selected, go to the Align Panel (Ctrl+K) and do the following:
1. Make sure that the Align/Distribute to Stage button is turned on, 2. Click on the Align horizontal center button and 3. Click the Align vertical center button.
Step 5
While the image is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

Step 6
Double-click on the movie clip (image) on stage with the Selection tool(V). You should now be inside the Movie Clip.

Step 7
While the image is still selected, hit F8 key (Convert to Symbol) to convert it again into a Movie Clip Symbol.

Step 8
While the new made Movie Clip is still selected, go to the Properties Panel below the stage. On the left side, You will find the Instance name input field there. Call this Movie Clip "background". See the picture below!

Step 9
Call the current layer image. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!
Step 10
Create a new layer above the layer image and name it mask.
Step 11
Select the mask layer and draw any shape.
Step 12
While the shape is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol.

Step 13
Select mask layer and convert it to a mask by right-clicking on the mask layer and selecting Mask. See the picture below.

Step 14
Go back now on the main stage (Scene 1). After that, select the Movie Clip (shape) and go to the AS panel (F9). Then, enter this code inside the actions panel:
onClipEvent (load) { startDrag (this, true); posx = _x ; posy = _y ; } onClipEvent (enterFrame) { background._x = posx - _x ; background._y = posy - _y }
We're done now!
Test your Movie (Ctrl+Enter).
Have a nice day!
Download source file (.fla)
|
|