On this flash action script 3.0 tutorial we create a timer that runs for 1000 milliseconds over 15 times.
This tutorial has background music., Pink Floyd TIME instrumental.
CLICK HERE FOR A COMPLETE TIMER AND TIME FOR FLASH ACTIONSCRIPT 3.0 CARTOON SMART TUTORIAL
Here is the Code
// Let’s create TIMER OBJECTS
// Let’s add a COUNTER !
var myTimer = new Timer(1000,15);
// One SECOND is made of 1000 MILISECONDS
// So the timer runs for 1 SECOND
// This will run 15 times for one second each.
// Lets create EVENT HANDLERS
myTimer.addEventListener (TimerEvent.TIMER, TickTack);
myTimer.addEventListener (TimerEvent.TIMER_COMPLETE, timerFinished);
// recognized words become BLUE
// TickTack is the name of a function we created. Can be any name.
// The function has to exist otherwise returns an error
function TickTack (e:TimerEvent):void // Our function is returning NO VALUE… void.
{
trace (” One Second… “); // The text in quotes is GREEN
}
function timerFinished(e:TimerEvent):void {
trace (“Time is up… thanks for watching”);
}
myTimer.start();
Download the Source Files
TimerEvents2Final






Thu, Aug 6, 2009
ActionScript