Saturday, 24 May 2008

Countdown timer

This Flash tutorial will teach you how to create a countdown timer. Countdown timer can be used in multimedia applications or games. For example a countdown timer can be used to simulate a rocket countdown or countdown clock in game. The results of the countdown timer will show numbered values decrementing every second. This tutorial uses Actionscript 2.0.

UPDATE: Countdown timer in Actionscript 3.0 version now available.

Countdown timer

Step 1

Create a new flash document.
Select the static text tool and type 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 layer 1 and select Actions and 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 stops 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.
Feel free to contact me for any questions or comments and remember to subscribe.

1 comments:

Anonymous said...

Thank you.

Post a Comment

Welcome to ilike2flash! If you like this post you can subscribe here to get updates via RSS or opt to have them sent directly to your inbox .

I appreciate your feedback, so please feel free to comment.