New to OFL and Android target question


I am new to OpenFL. I am trying to understand the Android platform targetting.

Is Android target creating flash based code or a native android code(java + ndk)? In otherwords when I target android do I have to write flash specific code ?

I have couple more questions but I will ask them later.


it is native code, no Flash/AS3.

First layer is Haxe. You write in Haxe, Haxe will be translated in different languages (as3,cpp,js,etc…)

Second layer is OpenFL/Lime (or Snow/Flow), which give you support for targets (ios, android, mac, windows, etc…)

Other (optional) layer could be an engine like HaxeFlixel, HaxePunk or Luxe, which give you functionality to speed up the development process.

Other (optional) layer could be a physics engine (Box2D, Nape… etc etc)…

And so on with small libraries and other stuff you can find on git or HaxeLib…

If you use OpenFL you will write in Haxe and could build for every supported target (usually almost in a transparent way).

If you want you can write stuff (in Haxe) target-specific or write extensions (in a target native language) directly for your target.

I suggest you to read some introduction about Haxe and then an introduction about OpenFL to understand better how this kind of ecosystems work.


Thanks for your reply. So the code that is generated by OFL does not use some kind of native player , like running byte code as does Flash?


As I said depends by the target.
To explain it the easy way:
If you target Flash it will be generated an SWF with Flash Bytecode to be run in the Flash Player
If you, for example, target iOS it will be generated an IPA compiled from CPP files generated by the Haxe compiler.
If you target HTML5 it will be generated a HTML+JS file to be run in a browser.
If you target NEKO it will be generated a N with Neko Bytecode to be run in the Neko Virtual Machine.
If you target Windows it will be generated an EXE compiled from CPP files generated by the Haxe Compiler.
And so on.

This is the power of Haxe, to be “compiled” in other languages.
Lime make it possible to target easily the supported platform. (just a CPP file cannot be run on iOS for example, you need wrappers)
OpenFL offers a library which make it easy to write the same code to be compiled for different targets. OpenFL/Lime is just one framework, there are others out there.
It was born to be “compliant” with the Flash API, so it is easy for developer who worked on flash a lot to write multiplatform easily. It is also nice that you can pretty easily port AS3 code for Flash in OpenFL with minimal effort.
If you don’t like the Flash API paradigm you should check the SNOWKIT project which aim (still in alpha) to provide a complete kit with an API developed with no constriction in mind.

As I said before, read more about Haxe and OpenFL in the guides on this site and the Haxe site. Everything will be clear.


Thanks for detailed reply. As I mentioned in my first post I am specifically interested in Android platform therefor I am trying to figure out exactly how it targets the Android platform.

So in respect to Adnroid target, is that going to be a flash byte code or native java with ndk? Or some other way?

Lets say that I do not want to target Flash for Android.

I hope I articulated a little better.

Android is compiled using the NDK. It’s totally native. If you need to access something specific to the android api, like GPS, you need to write a extension. The extension needs to be written in Java, and you communicate with the extension using JNI. There is already many extensions created by the community, the majority covering ads.



Thanks for your reply, that addresses my question.