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)

Timer

18.8.2006, 3:48    Total views: 63460

Learn how to create timer in flash using the action script code. You can use this timer effect for some photo presentation, flash banner. Let's start!



Example:
 




Step 1

Create a new flash document and click twice on layer 1 to rename its name into a pictures.



Step 2


Click on the first frame of layer pictures, press Ctrl+R on the keyborad (Imoport to Stage) and Import any picture.



Step 3

After that click on the fifth frame and press F7 (blank keyframe).



Step 4

While you're still on the fifth frame, press again Ctrl+R on the keyboard (Import to Stage), and import another picture.

Step 5

After that, click again on the fifth frame, open the Action Script Panel (F9), and paste this script:

stop();

Step 6

Insert a new layer and name it action.

Step 7

Click on the second, third and fourth frame of layer action and press F6 on the keyborad (Keyframe).



Step 8

Go back on the second frame, open the Action Script Panel (F9), and paste this script:

currently = getTimer();
end = currently + 2000;

Step 9

Click on the third frame, and paste this script:

currently= getTimer();

Step 10

Click on the fourth frame, and paste this script:

if (currently <= end) {
gotoAndPlay (3);
}


We're done!

Test your movie (Ctrl+Enter), and you'll see that your second picture will appear 3 seconds after first picture (like slide show).

Bye!

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

3. Photo slide show
Total views: 153641

4. High-tech city animation
Total views: 151459

5. Special Picture Effect
Total views: 146246

Related links