Prev | Current Page 424 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The
timer activates immediately upon the object instantiation and executes the run() method on each
elapsed interval. By default the run() method does nothing and the developer must replace the empty
definition with his or her own implementation. The stop() method interrupts the repetitions. Note that
once interrupted the execution cannot be resumed and a new Timer instance must be created in place of
the previous one.
In the following example, a timer instance is created. The run() method is implemented and traces a
counter value. On the tenth repetition the timer is stopped.
class Main
{
public static function main()
{
#if !neko
var timer = new haxe.Timer(100); // 0.1 seconds
var counter = 1;
timer.run = function()
{
trace(???count: ??? + counter++);
if(counter > 10)
timer.stop();
}
#end
}
}
Table 8-12
Syntax Description
\u0000 Where 0000 is a hexadecimal value for a Unicode character. Only supported
on JavaScript.
\x{0000} Where 0000 is a hexadecimal value for a Unicode character. Supported on
Flash 9 and on Neko when the option u is active.


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