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

前端 未结 5 964
野的像风
野的像风 2021-01-31 09:44

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 hav

相关标签:
5条回答
  • 2021-01-31 10:09

    New release of Haxe today. Adds official target of C++.

    So now you can target ActionScript and C++ with the same source.

    0 讨论(0)
  • 2021-01-31 10:11

    1) You can include one swf library (instead of a swc) while compiling using the -swf-lib compiler argument and if you need more than one lib you can merge multiple using the swfmill tool. There's an example of this in the Haxe docs.

    2) Branden answered this one perfectly :) Although I might add that one feature that does improve performance, in flash applications especially, is "inlining". Since Nicolas (the creator of Haxe) added even more byte code optimizations on inlined functions. And there's also even more of those optimizations planned.

    0 讨论(0)
  • 2021-01-31 10:17

    NME improves on Haxe's cross-platform support to provide a single API for Windows, Mac, Linux, Android, iOS, webOS, Flash and HTML5 applications without fuss.

    The Haxe compiler is notably faster than MXMLC, especially if you are used to compiling from the Flash IDE, instead of an IDE that hosts the Flex compiler shell, like FlashDevelop. As mentioned, there are also a number of added language features, like iterators, typedefs, structs, macros and other nice-to-haves.

    The great thing is that since you can always target Flash, there's little risk. The Haxe language is very similar, and if you don't mind supporting a single platform, you can target all of Flash's supported features. However, to the degree that you stick with NME's cross-platform API, you can experience huge performance and feature benefits for mobile and desktop platforms, or experiment with HTML5 support.

    Lastly, there's a SWF library that makes it possible to access SWF content from C++. This has always been possible on the Flash target, of course, but soon it should be reasonable to be able to define an interface in the Flash IDE, and use this in mobile or desktop C++ applications as well as the Flash/AIR target.

    0 讨论(0)
  • 2021-01-31 10:26

    You can find a lot of helpful stuff on lib.haxe.org ... (checkout haxelib for that matter (a bit like ruby gems, one could say)) ... there's also an AS3 to Haxe converter ... so could try translating relevant parts of the corelib to Haxe ... some manual fixing will be required though, i guess ... when it comes to controls, just check out the Haxe gui libraries ... there's a couple of them floating around the web ...

    Now Haxe pros: a good thing about Haxe is, that the compiler is much faster, so you don't spend a lot of time compiling ... seriously, it makes a difference ...

    Also, Haxe is a much richer language, as branden already implicitely stated ... I just wanna add, you should really check out enums ...

    Still, the best thing about Haxe is, that when i comes to write a server, you can stay with the same language, plus things like Haxe remoting make your life super easy ...

    There are some AS3 pros, but the thing is, that most of them are just related to the fact, that if you try solving problems in Haxe the way you would in AS3, the language seems quirky and shows unexpected behaviour at runtime ... if you stay strict and typed, everything turns out perfect ...

    Hope that helps ... ;)

    greetz

    back2dos

    0 讨论(0)
  • 2021-01-31 10:29

    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!

    0 讨论(0)
提交回复
热议问题