Timers in Actionscript 3
Posted by Wez | Filed under Flash/Actionscript, Text Tutorials
I'm writing this tutorial for someone who posted a comment on Basic Actionscript 3 Game Part 1 called sstng so if you would like to know how to do a certain thing in a language then feel free to post a comment and ask.
Timers in Actionscript 3 are really simple and easy to use and understand.
Sstng wanted to know how to create a timer that is triggered after 100 seconds.
Here is the code we would use to do this.
//set the time you want in milliseconds.
var myTimer:Timer = new Timer(100000, 1); //100 seconds
myTimer.addEventListener(TimerEvent.TIMER, theAction); //when the timer hits 100 seconds it will run the Action
myTimer.start() //start the timer
function theAction(event:TimerEvent) :void {
trace("Timer Triggered"); //output a message so you know its working
}
I hope this has helped.


September 10th, 2008 at 6:33 am
[...] public links >> actionscript3 Timers in Actionscript 3 Saved by lroosma63 on Tue 09-9-2008 Blender 2.46のArmature(アーマチュア)... Saved by [...]
September 20th, 2008 at 7:48 am
Thanks. Useful code. It does help
Suggestion:
Noticed you do not have a contact form in this site.
I tried to contact you and this was the only way to let you know.
Best
Tom
October 7th, 2008 at 10:56 am
People mostly get confused in using action script but your tutorial shows that it is not to hard to understand.