Prev | Current Page 658 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

Their value is immutable
and in haXe is generally coded as static variables of some classes, enums, or special keywords. Note that
in haXe, constants cannot be defined.
Chapter 12: Building Interactive Content with Flash
347
Top - level Functions
While AS makes an extended use of global functions, haXe has a very limited set of them and it is
impossible for the developer to define new ones. The most notably top - level function is trace . Behind
the scene the trace function is mapped to the haxe.Log.trace() static method, so in reality it is just a
syntax shortcut.
In haXe the Flash top - level functions have been moved to some class definition. In an extreme case of
necessity, when a flash functionality has not been introduced in haXe, it is possible to recur untyped
blocks like the following:
// for Flash 6 to 8
untyped _global[???System???][???capabilities???]
// for Flash 9
untyped __global__[???flash.utils.getDefinitionByName???]
Nevertheless it is not advisable to recur to such construct unless absolutely necessary because syntax as
in the preceding example is undocumented and subject to sudden changes in new versions.


Pages:
646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670