Added ported AS3 source to Haxe

Converted AS3 source to Haxe using as3hx with some manual tweaking here
and there.