Haxe and NME

Subscribe to Haxe and NME 22 posts

avatar for Feffers Feffers 244 posts
Flag Post

Couldn’t really find this anywhere so I decided to ask here: What does haxe and NME run on on an android? For example, if I created a flex mobile app in flash develop and exported it as an apk, I’d need adobe air to run it, but what does NME use? Does it need air or does it run on java? I’m asking this question because if I release an app I don’t want people to HAVE to install air just to run the app, I’d want it to work without installing anything but the app.
Will Haxe and NME help me with this?

 
avatar for Drakim Drakim 1137 posts
Flag Post

I’m a HaXe user but I’ve never used NME, but as I understand it, it works as a native Android application, not something that runs on Air or Java.

 
avatar for NineFiveThree NineFiveThree 1370 posts
Flag Post
Originally posted by NME:

When you target a native platform, such as […] Android, […] NME relies upon a library which uses common native components such […] OpenGL ES for mobile, libjpeg, libpng, Freetype, cURL, SDL and other native code (some written in Java and Objective-C) to power the API.

 
avatar for Feffers Feffers 244 posts
Flag Post

Oh, awesome! Thanks for the replies.
Also if anyone can help me with setting up NME, I have a few problems. I’m trying to do a tutorial (found here) and I’m up to the part of running the custom command “android” in FlashDevelop but I’m getting the “The system cannot find the file specified” message. Don’t know what I’m doing wrong, I’m sure I’ve done everything he did.

Edit: I had to click the “android” selection next to the Debug selection in FD aswell as running the custom command. >.> It wasn’t shown in the video because I have the latest version of FD.

Edit2: Got it to work on my phone! Yay x3

 
avatar for truefire truefire 3011 posts
Flag Post

My latest game is built with haxe and NME (I’ve only compiled it to swf and exe though). If you need any more help, feel free to PM me. (Or post here or whatever)

 
avatar for Feffers Feffers 244 posts
Flag Post

Nice! Love the music. May I ask why you are using NME aswell though? I thought it was made for exporting to ios, android, ect.

 
avatar for truefire truefire 3011 posts
Flag Post

I wanted to try out flixel, and the haxe port I used was NME-based.

Also NME asset embedding is nice.

 
avatar for Feffers Feffers 244 posts
Flag Post
Originally posted by truefire:

I wanted to try out flixel, and the haxe port I used was NME-based.

Also NME asset embedding is nice.

Yeah, the normal haxe embedding is a pain, couldn’t manage to get it working.
Also, another question: Which would perform better, as3 with air or haxe with NME on mobile?

 
avatar for Drakim Drakim 1137 posts
Flag Post
Originally posted by Feffers:
Originally posted by truefire:

I wanted to try out flixel, and the haxe port I used was NME-based.

Also NME asset embedding is nice.

Yeah, the normal haxe embedding is a pain, couldn’t manage to get it working.
Also, another question: Which would perform better, as3 with air or haxe with NME on mobile?

Pretty sure NME as it’s running native.

 
avatar for abyssgames abyssgames 3 posts
Flag Post
Originally posted by Feffers:
Also, another question: Which would perform better, as3 with air or haxe with NME on mobile?

http://esdot.ca/site/2012/runnermark-scores-july-18-2012

With NME you could build for old devices, where Air don’t work

 
avatar for Feffers Feffers 244 posts
Flag Post

Okai, thanks.
I’m probably going to be asking a lot of questions here because I can’t find any info of it anywhere else.

1) What’s the syntax for exiting an app in haxe and NME? When using adobe AIR I could just use NativeApplication.nativeApplication.exit(); I’m trying to use System.exit(0); but it doesn’t seem to work. The deactivation event runs but the system won’t exit.

2) Apparently when exporting to android, there are some classes that I can’t use like UInt (I just have to change to Int), or rotation properties on bitmaps. It works fine in flash but it won’t export when I use these properties with haxe and NME. So, is there any alternatives for rotations on display objects?

 
avatar for Drakim Drakim 1137 posts
Flag Post

In HaXe the Flash API is packaged slightly differently, so often you find the same things under slightly different names. If you google the HaXe API you can find a full listing.

There are some API methods that aren’t directly available at all. The solution to this is called externs, which is like an empty function that points to a real function in the native environment. NativeApplication.nativeApplication.exit() is one such thing.

Fortunately, externs are extremely easy to use. Here is one written for NativeApplication.

 
avatar for Feffers Feffers 244 posts
Flag Post

Sorry for being ignorant, but I’ve been trying and can’t figure out how to set it up. :/
If I put the class in flash>desktop it’ll give me an error that it can’t find the class when importing. This might be because my Main class is inside com>feffershat>game (Won’t compile without 3 or more). If I rename the folder to something like “flash9” I’ll get the error flash9/desktop/NativeApplication.h: No such file or directory Or In static member function 'static Void com::feffershat::game::Main_obj::deactivate(neash::events::Event)':
It only displays these errors when compiling for android, not flash.

 
avatar for dragon_of_celts dragon_of_celts 281 posts
Flag Post

Not to detour the thread too much, but how difficult is it to transition from AS3 to NME? It seems, based upon my cursory perusal of the NME About page, like it would be extremely worth the effort (ease of cross-compatibility!) — but since I’m having a hard enough time motivating myself to get my projects going (due to ongoing factors of which I shall spare you all the knowledge), depending on the size of the leap, I may be better off just whittling away in AS3 (then again, I suppose the best time to derail is when one is crawling along).

Addition: Sorry, I get the feeling that this has been covered already (probably in a thread I read at some point in the past). I’m going to use Kongregate’s sketchy search to go over some older threads mentioning NME over the next several days, but I’ll leave this here for now…

More: Thanks for the links. I’ll have to download all the (numerous) stuff and set it all up. I think I’ll just stick with AS3 until I’m done with the current project (since I doubt it will be much good on mobile devices anyway) and then possibly give it a try afterward… Now I just need a deadline not set by me and a cute Japanese woman that would be willing to be mad at me for missing it. ;D

 
avatar for Drakim Drakim 1137 posts
Flag Post

You could always begin here

 
avatar for abyssgames abyssgames 3 posts
Flag Post

Haxe NME API are almost identical to Flash, only instead of package “flash.” you should write “nme.”
http://www.joshuagranick.com/blog/2011/10/28/simple-box2d-example-as3-and-haxe-side-by-side/
On blog you could also find another sources.

 
avatar for Feffers Feffers 244 posts
Flag Post

Thanks guys.
I have yet another question to ask, though. When uploading my app to Google Play, it denies me saying that my app must not be signed with the debug certificate. I can’t find out how to sign it with another certifiate, though. I’ve got a generated cert but I just don’t know how to use it.

 
avatar for player_03 player_03 1249 posts
Flag Post

Do you have “Debug” or “Release” selected in FlashDevelop’s toolbar?

 
avatar for Feffers Feffers 244 posts
Flag Post
Originally posted by player_03:

Do you have “Debug” or “Release” selected in FlashDevelop’s toolbar?

I’ve selected release but it seems to only export a debug apk.

 
avatar for Feffers Feffers 244 posts
Flag Post

Tiny bump. :3
Still haven’t found a solution yet.

 
avatar for player_03 player_03 1249 posts
Flag Post

I think at this point you need to ask in the NME forums.

That is, if you haven’t already. (Sorry for taking so long to check back, by the way.)

 
avatar for Feffers Feffers 244 posts
Flag Post

Oh yeah, forgot to reply saying I already did and found the solution here for anyone else wondering. (: