Prev | Current Page 123 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

get(???three???));
// Outputs: 3
trace(myHash.get(???two???));
// Outputs: 2
trace(myHash.get(???one???));
// Outputs: 1
}
}
Having created the Hash , you then used the set method to add three items to the Hash object using
string identifiers, or keys. Next, you queried the Hash object using the same keys using the get method,
which retrieved the associated values.
Using Dates in haXe
The Date type is not considered as part of the standard types in haXe. However, haXe does support
dates and actually has quite an extensive list of tools for working with them. So extensive, in fact, that
the methods used for dealing with dates are spread across two classes to avoid bloating applications
that use them.
Table 3 - 6 provides a list of the methods available in the Date class.
Table 3-6
Date Method Descriptions
getDate() : Int Returns the day of the month as 1??“31
getDay() : Int Returns the day of the week; 0 = Sun, 1 = Mon . . .
getFullYear() : Int Returns the full year, i.e., 1976
getHours() : Int Returns the hour in a 24-hour format; 0??“23
getMinutes() : Int Returns the number of minutes; 0??“59
getMonth() : Int Returns the month; 0 = Jan, 1 = Feb .


Pages:
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135