Prev | Current Page 425 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


Unicode symbols The Unicode characters are directly embedded in the source code or loaded
from a text file; both must be encoded as UTF-8 to work properly. Supported
on any platform.
Chapter 8: Cross Platform Tools
223
Delayed Action
The Timer class also permits to easily delay the execution of a function that is not repeated. To do this,
use the Timer.delayed() static method. Note that the method returns a function; once this is executed
the timer starts and the delayed action is performed after the set interval.
class Main
{
private static function delayedAction()
{
trace(???delayed trace???);
}
public static function main()
{
#if !neko
var delayed = haxe.Timer.delayed(delayedAction, 200);
delayed();
trace(???I trace before the delayed once???);
#end
}
}
Queued Actions
Finally the static method queue permits creating a stack of functions; each function can have a different
interval before execution, even zero that is the default value if the interval is omitted, and it is
removed from the queue as soon as it is invoked.


Pages:
413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437