Repeating a Task over Time : Timer : Animation Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Animation » Timer »

 

Repeating a Task over Time


 

package {
    import flash.display.Sprite;
    import flash.events.TimerEvent;
    import flash.utils.Timer;
    
    public class Main extends Sprite {
        private var _PreviousTime:Number = 0;
        
        public function Main(  ) {
            var tTimer:Timer = new Timer(50010);
            tTimer.addEventListener(TimerEvent.TIMER, onTimer);
            tTimer.start(  );
        }
        
        private function onTimer(event:TimerEvent):void {
            trace(flash.utils.getTimer(  ) - _PreviousTime);
            _PreviousTime = flash.utils.getTimer(  )
        }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Animation
» Timer