Types like Float or String , because they are contained in the StdTypes module that is
imported by default and contains the definition the standard types.
Types declared in the current file.
Types declared in the imported files.
It tries to load a file matching the type name and it looks into it.
Importing an Entire Package
As already seen, it is not possible to import an entire package at once. To overcome this limit, it is
possible to use a sort of shortcut file. The file will contain the import statements and a small typedef
declaration for each type in the package, or just the ones that are frequently used together. Then when
the whole collection of types is needed, an import statement is used to call the shortcut file.
// content of file GeomImport.hx
import geom.Point; // the import is needed otherwise Point3D cannot be referenced
// ...
typedef Circle = geom.Circle
typedef Point = geom.Point
typedef Point3D = geom.Point3D
// ...
Which is used like this:
// content of file Main.hx
import GeomImport;
class Main
{
static function main()
{
var p1 : Point = new Point(1,2);
// .
Pages:
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294