R – Haxe – Flash project compiles fine, but won’t compile using hxcpp

actionscriptflashhaxehxcppiphone

In summary, I think my question is this:

How can I force hxcpp to compile haxe code for Flash 8 ?

Here's where I'm at. I'm new to haxe, and am trying to get a sample from here:

http://tilestudio.sourceforge.net/flash/Demo.html

to compile using hxcpp, in my tests to see how haxe compiled apps work on the iphone.

I've gotten other samples to compile fine and put them on the iphone, but when I compile this sample, it complains with things like:

Demo.hx:32: characters 17-53 : Class not found : flash.MovieClip
Demo.hx:42: characters 20-36 : Class not found : flash.Key
Demo.hx:44: characters 43-60 : Class not found : flash.Stage

and as I mentioned, this compiles fine using the following hxml file (flash.hxml):

-swf Demo.swf
-swf-lib DemoRes.swf
-main Demo.hx
-swf-header 480:320:100:808080

but fails as detailed above using this (cpp.hxml):

-main Demo.hx
-lib nme
-lib neash
-swf-lib DemoRes.swf
--remap neko:cpp
--remap flash:neash
-cpp cpp

So I think the problem is that hxcpp is targeting Flash version 9 swf's, and the haxe code is targetting Flash 8. I tried forcing it to accept Flash 8 syntax using "-swf-version 8" but it doesn't work (gives the same errors).

Best Answer

Although Neash is quite complete I am not sure it does map 100% of the Flash API. That said you have for sure a problem with -swf-lib that will not work with Neash; that beacuse it is not possible to embed swf files in other platforms than flash. You have to manage your assets differently. Maybe in a not so distant future it will be possible to embed even swf resources, but first someone has to write a nice decompiler that transform them for the intended target.

Related Topic