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

Fade photo effect using the button

17.6.2009, 10:51    Total views: 7411

This, step by step, detailed action script lesson, will show you how to create fade photo effect using the button and AS3. Using this lesson, you will also learn how to import any photo into a flash stage, how to convert it into a Movie Clip Symbol, how to create instance name and much much more! Let's go!

Example:



Step 1

First, find any photo which you like to use for this lesson.



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 34 and click ok.

Step 3

Call the current layer photo. 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 photo into a flash stage.

Step 5

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



Step 6

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 Photo. See the picture below!



Step 7

Create a new layer above the layer photo and name it fade button. After that, create some button, type on it fade and convert it into a button symbol.



Step 8

While the new made Button 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 Button myButton. See the picture below!



Step 9

Create a new layer above the layer fade button and name it action.

Step 10

Select now the first frame of layer action and go to the Action Script Panel (F9). After that, enter this code inside the actions panel:

import fl.transitions.*;
import fl.transitions.easing.*;

myButton.addEventListener(MouseEvent.CLICK, fadeMyObject);

function fadeMyObject(event:MouseEvent) {
TransitionManager.start(Photo, {type:Fade, direction:Transition.IN, duration:6, easing:Strong.easeOut});
}

We're done!

Test your Movie (Ctrl+Enter)

Have a nice day!

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

2. Water effect
Total views: 166041

3. Photo slide show
Total views: 153641

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146247

Related links