InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Haxe tutorials

  • How to view flash debug log using Firefox on Mac
  • List of mobile app/game development tools
  • Review of Haxe nme for cross platform mobile games development
  • haxe openfl on mac - quick start guide for mobile development
 
  • Home
  • > Tutorials
  • > Haxe

haxe openfl on mac – quick start guide for mobile development

By admin | Last updated on Aug 5, 2016

Haxe is a cross platform toolkit and supports cross compilation in many different languages. It is a pretty good choice for game and app development which are required to run on multiple platforms. OpenFL is a free and open source software framework and platform for the creation of multi-platform applications and mobile games in haxe. Here is a quick start guide for setting up haxe and openfl on mac on OS X El Capitan.

Prerequisite packages

These packages must be installed on your system before you proceed.

  1. Java JDK
  2. Android SDK
  3. Android NDK
  4. Apache Ant

Install haxe

First download haxe dmg (OS X installer) and install the haxe on your mac. Click on the downloaded dmg and follow the install instructions. Once installed you should see very likely see haxelib at location /usr/local/bin/haxelib and haxe at location /usr/local/bin/haxe. The installer installs haxe files at these locations (for OS X Yosemite):

/usr/local/lib/neko/
/usr/local/lib/haxe/

All other haxe libraries you install later will go in directory /usr/local/lib/haxe/. Now type haxelib on command line to verify installation.

$ haxelib
Haxe Library Manager 3.3.0 - (c)2006-2016 Haxe Foundation
  Usage: haxelib [command] [options]
  Basic
    install   : install a given library, or all libraries from a hxml file
...

Install openfl

Install openfl and openfl-samples using haxelib.

$ haxelib install openfl
$ haxelib install openfl-samples

Setup openfl

Use the following command for openfl setup:

$ haxelib run openfl setup

openfl setup will also install lime and couple of other packages. When it asks you “Do you want to install openfl command?”, you can enter “y” as shown below:

$ Do you want to install the "openfl" command? [y/n/a] ? y

setup openfl for android

Now we will setup openfl for android. Run the following command:

$ openfl setup android
Download and install the Android SDK? [y/n/a] ? n
Download and install the Android NDK? [y/n/a] ? n
Download and install Apache Ant? [y/n/a] ? n

Path to Android SDK []: /Users/pkjain/Documents/install/android-sdk-macosx 
Path to Android NDK []: /opt/AndroidNDK
Path to Apache Ant []: /usr/local/bin/ant

Provide the appropriate path locations for Android SDK, Android NDK and Apache ant.

Create openfl sample project

Now we use openfl create command to list the available samples.

$ openfl create
You must specify a template when using the 'create' command.
 Usage: openfl create project (directory)
 Usage: openfl create extension (directory)
 Usage: openfl create  (directory)

 Available samples:

  * AddingAnimation
  * CompareBitmapData
  * DisplayingABitmap
...
...

Now create one of these samples. We’ll pick NyanCat.

$ openfl create NyanCat

This will create NyanCat directory and you should be able to see project.xml file, Sources directory, etc. in this directory.

Running the sample project

You can build and run the sample project on a connected android mobile device (make sure USB debugging is enabled on your mobile) using these commands:

$ openfl test android --verbose

test command will build the apk, install it on android device and also call adb logcat command.
Here is how it looks when it runs on android:
haxe-openfl-sample-NyanCat

Note that you also also run this projects for other targets like flash, ios, html5, mac, etc.

Suggested posts:

  1. how to prevent a facebook app from posting on your wall
  2. CSS max-width – limit maximum wodth of an element
  3. Centos – save and restore iptables
  4. How to use CasperJS to automate website testing
  5. How to use rrdtool plot traffic from network interface
  6. HTML import
  7. How to use wildcard in robots.txt
  8. How to use phantomjs to create site/url snapshot thumbnail
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Game development, Haxe, Mac, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress