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: 22206

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.

Example:



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.stop();
photos_mc.addEventListener(MouseEvent.ROLL_OVER, overHandler);
photos_mc.addEventListener(MouseEvent.ROLL_OUT, outHandler);

function overHandler(e:Event):void {
 photos_mc.addEventListener(MouseEvent.MOUSE_MOVE,changeFrame);
}

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

photos_mc.width);
 photos_mc.gotoAndStop(frame);
}

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: 310977

2. High-tech city animation
Total views: 274205

3. Water effect
Total views: 237451

4. Photo slide show
Total views: 221126

5. Special Picture Effect
Total views: 190885



Related links

dans le cadre de leur collection automne / hiver 2008 de la ngc, marque japonaise a ainsi une fois de plus a porter.ADIDAS TUBULAR WOMENils ont travaillé sur l'ensemble des trois pieces et # 8211; un sac fourre - tout, une valise et un porte - clés / carte de voyage.ils présentent une gamme de produits classiques.le fait qu'elles offrent a la plupart d'entre eux en orange est un bon contraste.  via honeyee.ADIDAS ORIGINALS NMDon peut s'attendre a une libération de ce produit dans les semaines a venir.ADIDAS TUBULAR SCHUHEla broderie artiste kimberly scola est parmi ceux qui participent a ce los angeles & # 8216; & # 8220; cette fete et # 8221; exposition,ADIDAS YEEZY BOOST 550 inaugurée vendredi dernier.ADIDAS EQUIPMENT 10a l'occasion de l'ouverture, en cas de scola a collaboré avec une tapisserie de 100 faux sacs fourre - tout.Adidas Adizero F50 FGces agréables rappels d'un événement,ADIDAS X PLR malheureusement, seulement deux jours de liaison.ADIDAS MESSI 16.3 ICles points saillants de & # 8220;StartAdidas Ultra Boost Uncaged cette fete et # 8221; et une liste de cas suivent l'artiste.ADIDAS ACE 16.3 TF