Search code examples
flashactionscript-3haxelanguage-comparisons

Actionscript 3 vs Haxe: Which to chose for new Flash project?


I am in the planning stages of a new Flash game project and was wondering which language would be better to use? I already have a strong understanding of Actionscript 3, and have not worked with Haxe yet, but I have read the language reference docs and it seems that Haxe has some of the features from my other favorite languages, C# and Ruby.

So my question has two parts:

1) Can Haxe interop with flash components (swc files)? Like for instance if i use the Flash IDE to skin some controls, can i import those controls and use them in Haxe?

2) Are there any performance benefits to the Haxe compiler? or any gotchas?


Solution

  • 1) Yes, and no. As of 2.03 Haxe can export SWCs. This means you can write your code in Haxe , compile to a SWC and then utilize that SWC with Flash. Right now Haxe does not support SWC input, only output (though I believe they are working on this).

    2) Yes, there are benefits to using Haxe - unlike Adobe's compilers Haxe actually does some optimizations during compilation (this has been a major bone of contention in the community for a while). In addition, Haxe utilizes some "hidden" new bytecodes that came into being with Flash Player 10 that currently neither Flash or Flex utilize - only Adobe's Alchemy (which cross-compiles from C/C++ source into SWCs).

    The only "gotcha" that I know of is that it's kind of bizzaro ActionScript - things are just enough different that it will trip you up a fair amount. That being said, with features like generics and faster code that's small price to pay!