haxelib install openfl haxelib run openfl setup
Resources
We almost have all the building blocks in place now. Let’s see how to set everything up so that we can finally get started with our first project.
Haxe
If you have picked and installed your IDE, the next step is to download the latest version of the Haxe Toolkit. Each new release typically contains several important bug-fixes, which is especially important to maintain compatibility with the latest mobile operating systems. Thus, it’s recommended to always use the very latest version, and to keep an eye on the latest release notes.
You can find it here: Download Haxe.
A note about macOS
If you’re developing on macOS Catalina or later, you might be confronted with an error like the following:
The latest macOS versions require all executables to be "notarized" by Apple; however, the Haxe Toolkit contains executables that don’t satisfy that requirement. Hopefully, this will be fixed eventually; in the meantime, there is an easy workaround. Open up the Settings.app and navigate to the Privacy & Security section. Then scroll down to find the message that says that the Haxe PKG file "was blocked to protect your Mac." Click the Open Anyway button. |
OpenFL
After installing Haxe, you’ll need to download the OpenFL library. It’s as easy as opening your command line and running the following commands:
This will install the latest stable release of OpenFL and its dependencies. Like Haxe, you’ll always want to update OpenFL to the latest version as soon as possible to ensure that your projects run well on all supported operating systems. Especially on mobile, including iOS and Android, things change often, and OpenFL frequently includes fixes to address those changes.
Starling
Now all that’s left to download is Starling itself. You can choose between two ways of doing that.
-
Install Starling from Haxelib.
-
Clone Starling’s Git repository.
The advantage of the former is that it is easily configured in your project.xml file. Starling can be downloaded in a command line, similarly to OpenFL. It requires one simple command:
haxelib install starling
However, you’ll always only get the stable releases this way, which means you’re missing out on the latest hot updates and fixes! For this reason, I’d rather advocate using Git.
Let’s say you report a bug and it is fixed a few days later (yes, that can happen!): with the standard Haxelib bundle, you’ll have to wait for the fix until I’m creating a new stable release, which could be quite a while. When you’re using the Git repository, you’ll have the fix right away. |
Going into depths about Git would exceed the scope of this manual, but you’ll find lots of great tutorials about it on the web. Once installed, Git can clone the complete Starling repository to your disk with the following command:
git clone https://github.com/openfl/starling.git
This will copy Starling to the folder starling
.
Look for the actual source code inside the sub-folder starling/src
.
You can configure Haxelib to specify that this starling
folder is the location of the library.
cd starling haxelib dev starling .
But what’s best about this approach is how easy it is to update Starling to the latest version.
Simply navigate into the repository’s directory and pull
:
cd starling git pull
Some additional information for advanced Git-users:
|
Getting Help
The best of us get stuck sometimes. You might hit a road block because of a bug in Starling, or maybe because of a problem that seems impossible to solve. Either way, the Starling community won’t leave you alone in your misery! Here are some resources that you can go to when you need help.
- Starling Forum
-
That’s the main hub of the original Starling community for Flash. However, it also includes a special section for the Haxe and OpenFL version of Starling too. With years of posting history, it’s very likely that your problem has already been asked before, so be sure to make use of the search feature. If that doesn’t help, feel free to register an account and ask away. One of the most friendly and patient communities you’ll find on the web!
→ https://forum.starling-framework.org/t/starling-haxe - OpenFL Community
-
Don’t hesitate to ask your Starling questions on the official OpenFL community forums. Many developers who use OpenFL are experienced with Starling too.
→ https://community.openfl.org/ - Starling Manual
-
The online manual you are reading right now. I try my best to keep it updated for each new release.
→ https://books.openfl.org/starling-manual/ - API Reference
-
Don’t forget to consult the Starling API Reference for detailed information about all classes and methods.
→ https://openfl.org/starling/api/