Converting older Flash / Air projects

Hello good people,

I have been doing a lot of Flash and Air projects in the years before the platform got axed.
As I now am somewhat limited in my portfolio and cannot show earlier works, I was wondering how easy / hard it is to convert these into a Html5 / JS using OpenFL / Haxe or maybe even native applications.
I have converted one small older project using the phaser framework and while it was doable, I basically had to re-write a lot of code.
As I understand the OpenFL / Haxe way might be a good solution but as I said its a bit hard to determine how much work it will be.

Thanks for all input.

I think that you’ll have an easier time converting your project to Haxe/OpenFL than you did to JS/Phaser.

As a language, Haxe is much closer to AS3 than JS. The code still won’t be exactly the same, of course, but you can often copy/paste the body of a function and then make a few tweaks. Core types are often slightly different, like int to Int and Boolean to Bool. And for loops work a bit differently in Haxe too for (var i:int = 0; i < n; i++) to for (i in 0...n). There’s a bit more here and there, but it’s pretty straightforward.

You’ll also be using the same classes/interfaces from the flash.* package with OpenFL, except they’ll be in the openfl.* package instead. So you can mostly change the imports from import flash.display.Sprite; to import openfl.display.Sprite;. That’s probably your biggest win over switching to something like Phaser. Even if a library uses the same general concept of the display list, OpenFL is probably the closest to Flash/AIR in terms of having most of the same properties and methods implemented.

1 Like

Another difference is dynamic property access
as3
value = object["propertyName"];
haxe
value = Reflect.getProperty(object, "propertyName");

There used to be an “as3 conversion guide” here Introduction · GitBook but now it shows the “OpenFL Developer’s Guide” instead… I have no idea if that’s intended or not. It was not perfect but I remember it being helpful for me when I started using OpenFL (I started by converting a big as3 project)

There is (was ?) a tool called as3hx that I used to do the initial conversion of my code, it has its flaws (some code it can’t convert, some that converts badly) but it can be useful as well.

1 Like

Sorry about that. Fixed!

Thanks Josh, you rock man !

Thanks people!
That should get me some intel.