Search code examples
mobileflash-builderhaxenmeflexjs

Haxe, as3hx, NME, Apache FlexJS - Convert Flash Builder Flex project to HTML5+Js


Have used Flash Builder 4.6 in the past to create some mobile applications. The apps created runs fine only on high-end phone models but also runs slower than native apps. Especially when the app is 'booting', it takes a while when the app is fully loaded. I know why this is slower, because AIR is an extra application layer that translate it to native.

Let me tell you about my perspective. I know that developing software that is not native being slower than native. In some situations you need native (for speed, graphics etc.) but most of the time it is not really important (does not need that all parts of the software using the hardware directly). The thing I want to achieve is to reduce developing costs by developing it once and to be able to port it to many platforms (if required). I understand why there are so many languages around, this is in my opinion only because they like the language, want to bring something new because it is new, or to bind developers to a specific platform (a commercial reason). In fact, there are not many differences in type of hardware or the way it is operating, so why investing in 'new' things when it brings nothing new. I want to develop code that is long lasting, not bind to a platform hype or trend. For example, when you have invested to write code for a specific platform, let's say Window Mobile, your code is useless these days. Especially in the mobile world, things can change rapidly.

Anyway, lately I discover the existence of Haxe, didn't know this exists. Sounds very promising, using one language (AS-like) and port it to another language. A very interesting thing is that it is possible to port it to Javascript and use it for example in combination with phonegap to create mobile apps or to be able to use it on a website without it requires flash or embed it into an executable with the VM called Neko. They claim that the code it produce is faster than the original Adobe framework. I can imagine that it is faster because all elements of Haxe are blazing fast.

Then I found NME (didn't know this exists either), and this seems to be based upon Haxe and Neko, to create mobile apps for different platforms including Javascript and HTML5. This gave me the idea to port flex projects to NME,to get rid of the Adobe AIR requirement and maybe get the execution faster and to get more possibilities with the same code.

Then I found as3hx and some info on Apache FlexJS (formally known as Adobe FalconJS). as3hx translates the ActionScript code to Haxe code and FlexJS convert AS+XML to uneditable HTML5+Javascript code. I prefer as3hx because of the extended possibilities but don't how to implement the project after conversion (end up with some hx files only). Haven't try FlexJS because it seems experimental (not official) and requires to update the Adobe Flex framework with the newer Apache Flex Framework 4.9. I hesitate to update the framework in Flash Builder because I realize that I can screw up the original setup.

I have a few questions before I proceed with this process:

  1. Is it really possible to convert a (complex/huge) flex project to NME?
  2. What must I do after conversion of a flex project with as3hx to get it operational as project (to be able to compile it in NME).
  3. Have somebody tried the FlexJS approach and was is worth it?

For your information, some resources that leads to these questions:

Many thanks for any input and if you want some extra information, drop me a line.


Solution

  • Is it really possible to convert a (complex/huge) flex project to NME?

    Haxe NME is not designed as an answer for an alternative to a flex mxml ui project, so if you choose a flex ui you are confined to the limitations it has.

    NME has seen many complex as3 libraries ported so its not impossible, but flex mxml requires a huge investment and some might argue that Flex isn't worth the effort (myself included).

    http://www.aswing.org/ originally based on the java swing ui has both as3 and Haxe NME versions.

    https://github.com/RealyUniqueName/StablexUI/ and https://github.com/ianharrigan/haxeui are also both great options for Haxe / OpenFL(NME) cross platform uis.

    Tools like as3hx make the process of converting the most basic differences in as3/Haxe easier. It does not claim to be an absolute conversion and I have yet to see anything that can automatically convert highly complex as3 to Haxe. It is only a tool and wouldn't make use of optimizing as3 code to the more advanced and best language features of the Haxe language.