Icon following mouse cursor

4.8.2009, 17:23
Submited in: Flash | Total Views: 9763

Read this thoroughly explained, detailed flash lesson and see how to create that any icon follow the mouse cursor. To make this lesson, you have to use action script code. Using this lesson, you will also learn how to import any icon into a flash stage, how to convert it into a movie clip symbol, how to animate it using some special flash tricks and much more. Let's go!


Step 1

First, download png icon.

Step 2

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the dimensions of your document as whatever you like. Select any color as background color. Set your Flash movie's frame rate to 30 and click ok.

Step 3

Choose now File > Import > Import to stage (Ctrl+R) and import the icon that you just saved in step 1 into a flash stage.

Step 4

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

Step 5

Select the Selection Tool (V) and click once on the icon to select it. After that, while the new made Movie Clip is still selected, go to the Properties Panel. On the left side, You will find the Instance name input field there. Call this Movie Clip "icon_mc". See the picture below!

Step 6

Call the current layer icon. Double-click on its default name (Layer 1) to change it. Press Enter once you have typed in the new name!

Step 7

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

Step 8

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

Step 9

Click now on frame 10 and 20 and hit F6 key. Go back now on frame 10, select the Selection Tool (V) and click once on the icon to select it. After that, go to the Properties Panel (Ctrl+F3) below the stage! Then, select Filters tab from the left side. Click after that on the plus icon and select the Blur filter. Make the adjustments as follows:

Step 10

Right-click anywhere on the gray area between frame 1 and 10 and frame 10 and 20 on the timeline and choose Create Shape Tween from the menu that appears.

Step 11

Go back on the main scene (Scene 1).

Step 12

Create a new layer above the layer icon and name it action. After that, select the first frame of layer action and go to the AS panel (F9). Then, enter the following Action Script code inside the Actions panel:

startDrag(icon_mc, true);

We're done now!

Test your movie and enjoy!

Download example

Are you a website owner?
Click here to register and submit your tutorials!

Browse by category

Most popular tutorials