View Full Version : Timer


Backlight
01-26-2006, 02:45 AM
Ok here we go..


1. Open Flash and create a layer(now there should be two)

2. The size is no matter but the fps does however matter in this tutorial.. If it is set to high the users computer might not play the .swf very well but if it's to low it will look choppy.. I set mine to 40

3. On the stage on the bottom layer Draw two circles on inside the other
(colors are up to you)

4. Over that draw a square(this is where the time will be displayed

so far it should be looking like this..

http://img95.imageshack.us/my.php?image=10tg2.jpg

5. Now lets create a Dynamic text box in the square

6. Give the Text box a name of "timer"

like this.

http://img56.imageshack.us/my.php?image=28ek.jpg

7.Now in the top layer on the first frame open your actions panel and insert this code.


_root.onMouseDown = function() {
startTime = getTimer();
};
_root.onEnterFrame = function() {
currentTime = getTimer();
elapsedTime = (currentTime-startTime)/1000;
timer.text = elapsedTime;
};


With this coding when you click anywhere on the stage your timer will begin to count.

Now Test your movie...:)