229 karma · joined August 24, 2011
"static function main()" seems to work as an entrance point, though, which makes sense somehow...
I think Appcelerator is more adapted to applications that want to use native UIs elements (menus, buttons, layouts, etc).
Then you can still write an Appcelerator app using Haxe :) https://github.com/skial/haXe-titanium-desktop
I don't know how/if it's possible to mix both, for example embed a NME app inside an Appcelerator app (besides using UI.WebView and embed it as HTML...)
- Haxe/Flash supports embedding .swf libraries : http://haxe.org/manual/swc
- NME/C++ (Android, iOS, ...) has partial support for .swf libraries : http://www.joshuagranick.com/blog/2012/02/08/quick-notes-on-...
- NME/HTML5 doesn't seem to support .swf right now, but I think it's being worked out.
Then you have third party tools such as Flump or Flambe to help you: https://github.com/threerings/flump https://github.com/aduros/flambe
It basically provides an implementation of the Flash API for the C++ and Javascript targets, besides the SWF target that Haxe offers natively.
It also comes along with tools that allow this generated C++ code to be easily compiled and deployed to Android, iOS, Blackberry and WebOS devices.
So, if you write an app that targets Flash Player using Haxe, you can use NME to deploy to all these targets with no modification to your code.
You can compile this example to both Flash and JS online.
If you install Haxe and NME (http://haxenme.org), you can also compile it to iOS, Android, WebOS, BlackBerry, as well as desktop Mac, Windows and Linux binaries.
And these are only the possibilites offered by NME, which is basically a Haxe-based Flash API implementation.
It may still be a bit more verbose than Coffeescript or Python, but once your code is written you can theorically run it almost anywhere :)
Most standard classes and methods (String, Array, Hash, etc), and a lot of third party libraries are completely cross-platform, so you don't need conditional compilation.
Usually you use conditional compilation either for very low-level per-platform operations / optimizations, or to switch, say, between client code and server code, like here for instance:
Flash API to SWF or JS (nme/jeash):
Flash with custom shaders (hxsl):
Flash + away3d: