Flash tutorials
Home 3D (2) Actionscripting (66) Animation (108) Audio (4) Drawing (7) Full flash sites (4) Getting Started (15) Navigation (25) Special Effects (61) Text Effects (38)

Photo listing animation using the AS3 and mouse cursor

18.8.2010, 17:15    Total views: 22123

Today, Iím going to show you how to create advanced photo listing animation using the action script 3 and mouse cursor. You can use this AS animation for some presentation or for some web banner. Using this lesson, You will also learn how to import any photos into a flash library, how to animate it, apply action script code, create instance name and much more.


Move Your Mouse Over Photo!

Step 1

First, download photos that we will use for this lesson.

Step 2

Create a new flash document. Press Ctrl+J key on the keyboard (Document Properties) and set the width of your document to 350 pixels and the height to 263 pixels. Select white color as background color. Set your Flash movie's frame rate to 28 and click ok.

Step 3

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

Step 4

Choose File > Import > Import to Library. In the file explorer window that appears, find a siy photos and Shift-click to select them all. Then click open. If you now open your flash library (Ctrl+L key) you will see six photos that you just imported.

Step 5

Using the Selection Tool (V) and drag and drop technique, move the first photo from flash library on flash stage. After that, while the photo 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 6

While the photo is still selected, hit F8 key (Convert to Symbol) to convert it into a Movie Clip Symbol. Registration point set to the top left side.

Step 7

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

Step 8

Select now frame 2 and hit F7 key. After that, move the second photo from the flash library on the flash stage and aligned it with the background. Do this also for photos 3,4,5 and 6 and also for frame 3,4,5 and 6. See the picture below!

Step 9

Go back on the main stage (Scene 1).

Step 10

Select the Selection Tool (V) and click once on the movie clip (photo) to select it. Then, 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 photos_mc. See the picture below!

Step 11

Create a new layer above the layer photos and name it actions.

Step 12

Select the first frame of layer actions and go to the AS panel (F9). Then, enter this code inside the actions panel:

photos_mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
photos_mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);

function overHandler(e:Event):void {

function changeFrame(e:Event):void {
 var frame : uint = Math.ceil(photos_mc.totalFrames * photos_mc.mouseX /


function outHandler(e:Event):void {
 photos_mc.removeEventListener(MouseEvent.MOUSE_MOVE, changeFrame);

We're done!

Please Enjoy!

Download source file (.fla)

Have questions about this tutorial?
Visit our friendly Community Forums!
Digg it! Add this tutorial to del.icio.us! Furl it! Add this tutorial to reddit! Spurl it! Add this tutorial to technorati!

Top tutorials

1. Advanced full flash site - Part 1
Total views: 310287

2. High-tech city animation
Total views: 272904

3. Water effect
Total views: 237059

4. Photo slide show
Total views: 220388

5. Special Picture Effect
Total views: 190723

Related links