2

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.

Gama11
  • 31,714
  • 9
  • 78
  • 100
Codebeat
  • 6,501
  • 6
  • 57
  • 99
  • As a former Flash Developer I have been using NME with HaXe for the past year. I think it is great and have used it for a mobile game. Not so sure how easy it would be to port an existing flex project that relies on various components etc though. – Allan Mar 31 '13 at 15:23
  • Hi Allen, thanks for your reply. Was playing around a bit with NME, but it doesn't seem that it is possible to port flash objects to another language/target other than flash. Downloaded some demo's and try to compile it to Javascript for example. Get the error: You can't access the flash package with current compilation flags (for flash.display.Sprite). If it is not possible to do this, what is the point of these targets or do I miss something? How is it possible that they claim to be multilingual if you cannot use it. Sounds to me a little pointless or not? – Codebeat Mar 31 '13 at 19:10
  • You need to ensure that you are using nme.display.Sprite instead of flash.display.Sprite. The nme.display.Sprite (and all the nme classes that mimic the Flash API) have compiler conditionals for compiling to the platform you have chosen. – Allan Apr 01 '13 at 03:50
  • Hello Erwinus, 7 months passed on your question, I am very interested to know, what choice have you chosen? did you wait Adobe to polish AIR performance? or did you use haxe NME? I already started my android app using openFL, I like some one to tell me that I took the right decision, as I prefered openFL over Adobe AIR .. – simo Nov 25 '13 at 06:34
  • Simo > Well, put it in the fridge for a long time. It is not possible to covert a whole flex to HaXe, it is pain, real pain. So decide to leave it as is like the answer on this page said. Didn't look at openFL, looks promising but no time to take a look at it. I optimize my code a bit by not including images as resources but as assets in a directory. This reduces boot time but introduces some delays between views. A huge benefit of Flash Builder is the application signing process to get it into a store, how does it work with openFL? – Codebeat Nov 25 '13 at 21:34

4 Answers4

2

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.

imp
  • 1,110
  • 8
  • 13
  • As an additional tidbit to add; the bulk of the Flex Framework is written in AS3. The only MXML parts are some of the Spark Skins. The Flex Compiler will take MXML and turn it into ActionScript. All the Flex apps I have seen make extensive use of MXML. If NME can easily port ActionScript; then it may be possible to work something up with the generated ActionScript from the Flex Compiler and a 'converted' version of the Flex Framework. I know nothing about NME to judge the viability of this; though. It sounds, potentially, like a massive undertaking. – JeffryHouser Apr 01 '13 at 01:59
  • Thanks, i think i skip the whole idea. – Codebeat Apr 01 '13 at 22:08
1

I would highly recommend FlexJS, especially for anyone with an exsiting AS3/Flex project. A lot of progress has been made this year with FlexJS. Why re-write the whole thing when you could stick with tools and the AS3 language you already know? I've been working with FlexJS and recently created an entire website frontend, backend and mysql connection all written in AS3 and compiled to javascript for Node.js. It's truly amazing.

Flash Builder with FlexJS https://cwiki.apache.org/confluence/display/FLEX/Using+FlexJS+with+Adobe+Flash+Builder

Tutorials and Tools Josh Tynjala has created a lot of great resources here. http://nextgenactionscript.com

I hope to add my own tutorials soon.

0

It seems that your path of building project is too long to be completed fast. Currently Adobe's main goal for flash platform is to make it a sweet candy for game developers, that means they definitely pay LOTS of attention to air and flash player performance.

Maybe it is faster to wait for their performance updates than to play with haxe(which is very beta-like thing) or javascript(which is very questionable language).

user1875642
  • 1,303
  • 9
  • 18
  • I think your right about the traject. It is better to rewrite it if it is needed. Javascript a very questionable language? I think you are wrong about that, maybe you had a bad experience with it? I'm very good at Javascript, it is very easy and powerful if you know anything about pointers. – Codebeat Apr 01 '13 at 22:16
0

I'm sorry to dash your hopes, but I'm dealing with the same issue of getting away from Flex and going towards HTML5/JS. You can bang your head against trying to convert your large flex application to HTML5/JS for months if you want, but in the end it will be easier to just rewrite the entire thing in a library like ExtJS.

jugg1es
  • 1,560
  • 18
  • 33
  • I think you are right, rewriting is the best and fastest way. I will do it with my own library, jquery and phonegap. Also found this: StablexUI (http://stablex.ru), looks promising but i do not know if you can rely on it. And this one:http://ivank.net, based on canvas and looks incredibly good. Only one sad thing is that it is not working on my Galaxy S. Problem with the HTML/JS solution and phonegap is that most of the time sound is not working on Android 2.3. That is not a problem of phonegap but Android. Nice thing of NME is that you can also create an flash demo of it. – Codebeat Apr 01 '13 at 22:02
  • Besides using NME to produce HTML/JS, the code is huge (approx 500kb for a very simple app that plays a sound). Also the code produced by NME/HaXe contains errors (suspicious code). I don't know if i will give it a try. – Codebeat Apr 01 '13 at 22:06
  • yea, you will get much better performance if you rewrite from scratch – jugg1es Apr 01 '13 at 22:35
  • @Erwinus "code produced by NME/HaXe contains errors (suspicious code)" this sweeping statement is rather superfluous unless you can demonstrate these errors. NME html5 target is almost the entire flash runtime api inside a js file so yes it will be 500kb or so. You can also use the -minify compiler flag and make sure --dead-code-elimination is on. Haxe is actually a brilliant Type Safe OOP language to write js, see a most minimal example on http://try.haxe.org/. You are not limited to NME with Haxe/JS. – imp Apr 02 '13 at 10:19
  • I can demonstrate it and google enclosure compiler detects it, for example: if( ... ) {} else null; I take a look again and will try your suggested option. – Codebeat Apr 02 '13 at 20:12
  • How is the rewrite coming along w/jquery? Were you able to implement all the functionality with the same quality and interactiveness as the Flex version? – Manius Feb 09 '15 at 06:09
  • @Crusader not sure who you mean, but I am in the final stages of testing for an app I ported to javascript (primarily ExtJS) from Flex with an Objective C wrapper (for web service calls). I've had a lot of success with this new non-Flex version and it's portable across all platforms. I've also started using Xamarin, where you can use C# to build native apps across all platforms. It seems very nice so far. – jugg1es Feb 09 '15 at 20:53
  • Oops, commented in the wrong place. But I guess the same question still applies.. would you say that you've been able to duplicate all the features the Flex app had? Success is one thing, but is it better, worse, faster, slower, more/less productive to develop or maintain and so on? – Manius Feb 13 '15 at 04:09
  • Using Javascript, I developed a logic engine for the app that is now portable anywhere. One code base for everything. HTML5/CSS3/JS can do everything Flex can do plus a lot more (and way easier) and there is a LOT more community support with the thousands of libraries, like angularjs or kineticjs. Even CSS3 can use a 'calc' function and has built-in animation transitions, usually with just 1 line of CSS. Flex is such bulls**t as of now (February 2015) in comparison – jugg1es Feb 13 '15 at 05:44