Saturday, 24 May 2008

Countdown timer

This Flash tutorial will teach you how to create a countdown timer. Countdown timer can be used in games or multimedia applications. For example countdown timers can be used to simulate a rocket countdown or countdown clock in game. The result shows number values decrementing every second. This tutorial very basic and requires action script.

Countdown timer

Step 1

Create a new flash document.
Using the static text tool write your message on the stage.


Step 2

Select the dynamic text tool and drag a box shape like below:


Step 3

On the timeline right click on the first frame of the layer 1 and hit F9. Enter the following lines of code.

count = 60;
countdown = function(){
count--;
if (count ==0){
clearInterval(doCountdown);
}

}

doCountdown = setInterval(countdown, 1000);

**The current count is 60 seconds but you can change it to whatever you wish. This code contains the cleartInterval() method which stop the function call. And also contains the setInterval() method which calls the time in milliseconds.


Step 4

Using the selection tool (V) select the dynamic text box and enter the variable “count” in the properties tab.


Step 5

Test your movie Ctrl + enter.



You should now have a count down timer.

0 comments:

What next ?

Subscribe to Flash Tutorials

Add to Technorati Favorites

Follow my Twitter