Download OpenFL
OpenFL is a cross-platform library that supports multiple programming languages. To access all compilation targets supported by OpenFL, including native C++, choose Haxelib (Option 1) below. For projects targeting the web browsers only, consider npm (Option 2) instead to be able to use additional languages — including JavaScript or TypeScript.
Haxelib (Option 1)
OpenFL is available to install from Haxelib. It supports HTML5, native desktop, native mobile, AIR and Flash development from a single toolset and the Haxe programming language.
To get started, install Haxe globally on your system.
With the latest versions of Haxe and Neko installed, open a command-prompt (Windows) or terminal (macOS/Linux) and run these commands:
haxelib install openfl
haxelib run openfl setup
In order to check if OpenFL has been installed properly, try running the openfl
command:
openfl
Run a Sample
You can use the "openfl create" command for a list of available samples.
openfl create
For example, here is how to build and run the DisplayingABitmap sample on HTML5:
openfl create DisplayingABitmap
cd DisplayingABitmap
openfl test html5
Next Steps
Now that OpenFL is installed, you can choose a code editor or learn how to use OpenFL by creating your first project.
NPM (Option 2)
If you would like to use OpenFL for a web-only project, OpenFL is also available on npm.
Start by installing Node.js and npm globally.
Then, install Yeoman for generating a new OpenFL project:
npm install -g yo generator-openfl
This workflow supports TypeScript, Haxe, ES6 JavaScript or ES5 JavaScript-based development, but it is not designed to cross-compile to native desktop or mobile targets.
mkdir NewProject
cd NewProject
yo openfl
Run a Sample
There are many OpenFL samples you can try, depending on the code environment you wish to use:
Choose a sample, then npm install
and npm start
in the local directory to start a development server (with hot-reloading enabled):
git clone https://github.com/openfl/openfl-samples-ts
cd openfl-samples-ts/features/display/DisplayingABitmap
npm install
npm start
Next Steps
If you do not have a code editor already, Visual Studio Code is a good choice for that integrates well with OpenFL and NPM.
Problems?
If you have any questions or concerns when you are installing OpenFL, do not hesitate to visit our friendly community forums or Discord server. Thank you for trying OpenFL, and please let us help if you have any problems at all.