Haxe Forum > porting an enterprise app to haxe
mrfink May 16 at 18:59
I wonder if anyone can let me know whether I've got the right idea about what's possible with haxe.
So, we have a large enterprise application written in flash, it has ~50 modules that compile to separate swc's. We would like to port this to haxe, and then publish it to multiple platforms (ideally iOS & android, currently browser based flash player only).
I have two questions regarding this process:
- Would it be possible to use our existing SWF modules written in flash and compile them into a haxe lib using --swf-lib ?
- If not would it be possible to port them module by module, and have the haxe-ported modules compile to swf's and interact with the non-ported modules as usual until all are ported ?
Basically what I am trying to get to the bottom of, is whether we would need to rewrite the whole app in haxe, or we can get away with compiling the existing code in.
Thanks for your help.
Justin L Mills May 16 at 20:33
There is very limited support for swf only graphics in NME ( no swf code supported ). AS3 externals will only work with the Flash target so you can only do what your suggesting if you intend to publish for swf. I have worked on fb games where we used flashIDE graphics and a spot of AS3 code with a mostly haxe flash code base, it works extremely well and for pure flash haxe integrates well in many ways from using lib, loading at runtime to swcs, but it is not so simple for not flash code.
Basically how it works.. haxe flash classes are remapped to nme classes ( c++ or neko ), you could try using 'format' library to disassemble a swf and it's byte code and then try to reassemble as haxe code but not so possible, but it maybe an approach to extracting graphics as lineTo etc...
There has been some great progress recently with an as3 to haxe parser using macros I think most recently by Russel and I think also Niel, but it is not publicly released, so you will also have to hand port parts that fail, but I have used it and it seems to be a very powerful tool.
You can find out about NME ( remap of flash classes to c++/neko - used for iphone, android, desktop ) at http://www.haxenme.org
Not sure if that helps...but if your looking for a coder to help with porting as3 to haxe I freelance and, I am currently free :)
Jan has written externals for AIR3 support I think so you can also use haXe to target AIR maybe a stepping stone in porting the whole codebase to NME.
mrfink May 20 at 18:01
So to clarify a few points:
- There is very limited support for swf only graphics in NME: By this do you mean using flash vector drawn graphics / movieclips from a swf library does not work well in NME, and it's better to use bitmaps ?
- AS3 externals will only work with the flash target: So without porting the code to haxe, just using the --swf-lib option to include the flash libs we would only be able to publish to flash anyway ?
Sounds like the best option would be to port the code to haxe with a combination of as3hx and hand-coding, then use NME to target iOS / Android. Just wonderng how much work will need to be done on existing graphics, but I guess some experimentation should reveal that.
Justin L Mills May 20 at 23:17
MFink your pretty much stuck with bitmap ( png or jpeg ) spriteshetts and svg if your targeting phones with NME.
Since NME and AIR3 are both based on flash movieclip structures you can use a very similar haxe codebase I read somewhere air worked well on iphone but NME on android.
If your using flash ( AIR externals ) you can use swf assets, but I would advise converting assets so you can use NME as well especially as there are also other haxe alternatives such as openframeworkhx, hxprocessing, and now I believe the java externals are working although only today so not tried them yet.
There is a haxe2 book that may help you get started with some of the technicalities of targeting flash and NME or look through the tutorials and ask question both on this site or over at haxenme.org