1

I am thinking of learning Haxe, after extensive as3 experience and some javascript/nodejs but several people have stated that haxe compiles into a swf and encapsulates it to be run on "insert platform here" making it both incompatible with some native features and with significant overhead.

I am interested in knowing about ipad/iphone specifically. Does this somehow compile into a format compatible with such apple devices? I mean does it translate to x-code then compiles it or what?

I have various clients that want cross platform versions of the same application and Haxe looks like a simple, elegant solution but since my clients are from US, Apple products are a concern to me.

My scope of projects revolves around simple apps with server services and maybe some webcam/microphone action, if this helps for an answer. Cheers.

3
  • Are you asking about haxe or openfl in particular?
    – npretto
    Jan 21, 2014 at 11:06
  • Haxe. Never heard about Openfl till now. Feel free to steer me to it if its superior.
    – Discipol
    Jan 21, 2014 at 11:23
  • Haxe is just a programming language that can "compile" to other programming languages, openfl is a library/framework for haxe that emulates the flash API to other platforms. When you hear that people have ported their flash game to iOS with haxe they probably used openfl. I cannot speak for iOS, but I've used openfl for android and I can tell you that it will use the NDK (so the haxe code will be converted to c+) but it will also provide with an eclipse android project that you can compile/modify yourself.
    – npretto
    Jan 21, 2014 at 11:27

1 Answer 1

12

haxe compiles into a swf and encapsulates it to be run on "insert platform here" making it both incompatible with some native features and with significant overhead.

This is a big misconception. Though as with any cross-platform tech, it's a somewhat nuanced answer.

First, know that Haxe is simply a programming language that compiles to many other language (& bitcode) targets, e.g. JavaScript, C++, PHP, python, SWF, hl, neko and others.

Compiling to C++ is the typical path when building native Android and iOS apps (and Windows and Mac apps, for that matter). Also, Haxe is just the language. Usually a framework is used for building apps, and there are many choices -- OpenFL, or its predecessor Haxe NME, or heaps.io, or HaxeFlixel, or luxe, or Kha.

Each framework is unique in paradigms and workflows, but for example, last time I used OpenFL, it exports an XCode project with C++ code when building for iOS. You are then expected to open and compile the project in XCode and onto your device (or for the app store), just like any other iOS app.

While using a framework is a common way to build apps with Haxe, you can roll your own, if you like, for example:


Compile Haxe to JavaScript, using externs to leverage existing JS libs (e.g. here's a set of Pixi.js externs, or the built-in jQuery externs), and develop mobile web apps with Haxe. Note: many of the above frameworks support a Haxe -> JS workflow.


Compile Haxe to SWF, and then use the Adobe AIR SDK to package your app as a native iOS / Android app. This avoids XCode and is possible from Linux and Windows (where compiling an XCode project is not). Perhaps this flow is what those other people were talking about.


5
  • 4
    Thanks Jeff. I will think of you fondly, on my death bed.
    – Discipol
    Jan 21, 2014 at 17:10
  • 3
    If you're a mobile app developer, I imagine that could be all too soon. =)
    – Jeff Ward
    Jan 21, 2014 at 17:16
  • I think you are confusing C and C++, Haxe is translated to C++ not C when using openfl, the C target for haxe is still a work in progress.
    – npretto
    Jan 21, 2014 at 18:09
  • Thanks @lordkryss, updated to C++. For those of us who don't use those native languages much, we tend to confuse them.
    – Jeff Ward
    Jan 21, 2014 at 18:16
  • 1
    Just to add to the fun, you can also use Haxe to target JS on iPad. This is the approach taken by Flambe and has decent performance, I've played some finished games with it and was relatively impressed with performance etc... Jan 22, 2014 at 1:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.