Revision: 33051
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at October 5, 2010 13:46 by heathbo
Initial Code
import flash.utils.Timer; import flash.events.TimerEvent; import flash.events.Event; private var myTimer:Timer = new Timer(delay, repeat); myTimer.addEventListener(TimerEvent.TIMER, timerHandler); myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler); myTimer.start(); private function timerHandler(e:TimerEvent):void { repeat--; statusTextField.text = ((delay * repeat) / 1000) + " seconds left."; }; private function completeHandler(e:TimerEvent):void { statusTextField.text = "Times Up."; inputTextField.type = TextFieldType.DYNAMIC; };
Initial URL
Initial Description
delay is in milliseconds. repeat must be set to at least 1.
Initial Title
How to set, start, and use a Timer
Initial Tags
Initial Language
ActionScript 3