Setting Up Haxe and NME in FlashDevelop

Tired of jumping between different languages when working on new projects? Looking to reuse your game engine across many different platforms with no extra porting effort? Haxe is an open source write-once build-anywhere language and compiler developed with this in mind.

With the current trend of ubiquitous gaming brings the need for ubiquitous game development, and what better way to get the best bang for your buck than to write in one language that does all the native compilation legwork for you.

I’ve been looking into Haxe as a means of time-efficient distribution between multiple platforms. My main rule was that the applications had to be natively compiled (as I’ve found HTML5 performance to be heavily lacking, even when virtualised). It lead me to Haxe as a solution, and its simplicity was impressive.

This guide covers how to set up a Haxe project with NME in FlashDevelop for Windows.

Installing NME

1. Go to http://www.nme.io/download and download the Windows installer.
screen.current.2
2. Run the installer and accept all defaults (screens provided below for reference).

screenshot.2 screenshot.3

3. Open up “Windows Command Prompt” and run “haxelib upgrade to make sure all packages are up-to-date. If asked, enter “y” to agree to upgrade selected packages.

screenshot.6

Installing Java

FlashDevelop requires 32-bit Java to be installed in order to run builds in debug mode.

1. Go to http://java.com/en/download/manual.jsp and download “Windows Offline (32-bit)” Java installer.

screen.current.12. Run installer, accept all defaults if there are any.
3. Locate your Java installation path (try looking somewhere like “C:\Program Files\Java\jre7”) and remember the location.
4. Open up “Environment Variables” settings, highlight “PATH” in “User Variables” and click the “Edit…” button.

screenshot.11
5. Add a semi-colon followed by the Java installation path to the end of the Variable Value like so:

screenshot.126. Restart your PC to allow the Java installation to take effect.

Installing FlashDevelop

1. Go to http://flashdevelop.org/ and click the green Download button to go to the download page.

screenshot.132. The link will take you to a page release notes with bug fixes and new features. There is a download link at the bottom of the post.

screen.current.33. Run the download file. It may say that you should install “Flash Player (ActiveX for IE)” – you don’t need it for this tutorial and I’ve never needed it in development.
4. When installing, untick the AIR and Flex SDKs from the Components menu – they are not used in developing for Haxe and will save you time and disk space if you skip it. The rest of the options can be kept as default.

screenshot.16 screenshot.15Creating a New Project

1. Open FlashDevelop from the Start menu and select “Project” > “New Project…” from the menu bar at the top.

screenshot.192. Choose an “NME Project” from the list and select the “Create directory for project” checkbox at the bottom.

screenshot.203. Enter your name or your company’s name if prompted (this is just meta text that gets added to new scripts you create).
4. Make sure “Debug” and “flash” are selected at the top next to the blue play button in FlashDevelop. Press “F5” or the blue play button to build and run your first project.

Note: FlashDevelop can occasionally throw errors in the output when building Flash Debug versions (as it’s using the debug functionality of the FlashDevelop build tool – FDB). Most commonly the message is to do with a “jvm.dll” not being found, even though that should be fixed when setting Java’s directory in PATH.


One thought on “Setting Up Haxe and NME in FlashDevelop

  1. Where were you, good soul, one year ago when I had to find out how to do it ? 😉 The biggest bitch was the java version… anyways.
    That’s it kids, what the post says, fastest and simplest way to get a kick ass Haxe+NME+IDE install going.
    Great post.

Comments are closed.