toranlation to Haxe
moving as3 code.