Timer

class haxe.TimerAvailable in flash8, flash, neko, js, php, cpp, cs, javaExecutes a function repeatedly, waiting a set amount of time between calls. To use a timer, create it and set the run method.
This is only supported on platforms that provide a native event loop.
function new( time_ms : Int ) : VoidAvailable in flash8, flash, js, cs, javaCreate a new timer that calls run every time_ms milliseconds. dynamic function run() : VoidAvailable in flash8, flash, js, cs, javaThis is the [run()] method that is called when the Timer executes. It can be either overridden in subclasses or directly rebound with another function-value. function stop() : VoidAvailable in flash8, flash, js, cs, javaStops the timer. static function delay( f : Void -> Void, time_ms : Int ) : TimerAvailable in flash8, flash, js, cs, javaThis will delay the call to [f] for the given time. [f] will only be called once. static function measure<T>( f : Void -> T, ?pos : PosInfos ) : TMeasure the time it takes to execute the function [f] and trace it. Returns the value returned by [f]. static function stamp() : FloatReturns the most precise timestamp, in seconds. The value itself might differ depending on platforms, only differences between two values make sense.
version #19730, modified 2013-09-06 22:17:47 by adampasz
1 comment
  • May 19, 2013 at 15:24
    var yourTimer:haxe.Timer = new haxe.Timer(1000);
    yourTimer.run = function():Void{
       trace("aa");
    };