Skip to content

About haxe

Mark Knol edited this page Apr 17, 2014 · 2 revisions

For more info you should check out http://haxe.org, API docs and Haxe manual but as a quick reference this could be useful.

Type check

Std.is(myInstance, Sprite);

toString anything

Std.string(myThing);

Check if NaN

Math.isNaN(15);

Get type of class

Type.getClassName(Type.getClass(str));

hasOwnProperty

Reflect.hasField(myInstance, "x");

Casting

// explicit resolve type
var poolable:IPoolable = cast(child, IPoolable);

// auto resolve type
var poolable:IPoolable = cast child;

Language comparison cheatsheet

Basic types

Haxe

Bool
String
Int
Float
Dynamic
Void
Array<Dynamic>
Array<String>

Javascript

Boolean
String
Number
Number
Object

Array Array

AS3

Boolean
String
int
Number
Object
void
Array
Vector.<String>

TypeScript

boolean 
string
int
number 
any
void 
any[]
string[]
Clone this wiki locally