Prev | Current Page 655 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"


(continued)
Chapter 12: Building Interactive Content with Flash
345
Another big difference between the three languages is that AS2 and haXe accept null values in place of
the basic types, whereas AS3 will automatically convert them to their default values:
0 for Int ( int in AS3) and UInt ( uint )
NaN for Float ( Number in AS3)
false for Bool ( Boolean in AS3)
To overcome these differences haXe provides a Null < T > type that permits defining the aforementioned
primitive types as null . In the vast majority of cases, replacing a value with its Null < T > counterpart has
negligible performance effects, but for very intensive operations it is advisable to use only the basic
types. Note also that a basic type used in place of an optional argument is implicitly transformed in its
Null < T > counterpart.
Tables 12 - 1 and 12 - 2 describe some common AS2 and AS3 constructs and the equivalents in haXe. The
tables also specify in which Flash versions the features are available.
??‘
??‘
??‘
Table 12-1
ActionScript Type
(Flash Version) haXe Equivalent
*
(F9)
Typed parameter or Dynamic
The * in AS3 denotes an untyped variable.


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