Haxe Tutorial – Upgrading/Downgrading Haxelibs

This isn’t really HaxeFlixel related, but I encountered an issue when I recently upgraded my haxelibs.

Haxelib is a collection of haxe (.hx) files that expand on existing Haxe language to make life easier for the developer. OpenFL, a game framework, is a haxelib. HaxeFlixel is also a haxelib that expands on OpenFL.

The issue I faced was — I upgraded my OpenFL version from 2.2.8 to 3.0.0-beta. The framework apparently has been overhauled, and as a result, broke HaxeFlixel’s API. In fact, I couldn’t even get an empty HaxeFlixel template project to compile.

So here’s a note for awareness:

Use this command to upgrade all your existing libraries to the latest version:

Use this command to check the library info (which mentions the library versions):

Use this command to upgrade/downgrade your library:

As such, I had to downgrade my OpenFL version to 2.2.8 in order for HaxeFlixel to work again. So, if you ever encounter a problem with compiling your code even though it was never modified, check if the haxelib upgrades broke anything. :)

EDIT:

Ashiq brought up an idea in the comments, which I overlooked — you can set your haxelib versions for your individual projects. This would help ensure your older projects do not risk getting broken by future haxelib upgrades.

As shown in the OpenFL XML format page, you just have to go to your Project.xml file and add a “version” property to your include code, something like this: