Port a Flash app written in Haxe to Adobe AIR

A company that I support has an application that is written in Haxe that compiles to Flash. The application is a business app that loads data from a server using AMFPHP. I have absolutely no experience with Flash or Haxe, so this is very new to me. The code that I have for the current application consists of two projects, the one involves a compile using MXML, and to the best of my knowledge this is a collection of flex components that get used in the second project. The compile for the first project is as follows:

mxmlc -output …/index.swf Main.mxml

The second project is the main application that imports index.swf. This compiles with Haxe 3.4.7, but does not compile with the latest version of Haxe. When I tried this compile with Haxe 4.1.4 I got errors regarding haxe.remoting.AMFConnection not being found and a whole string of errors about “Field xxx has different property access”.

Here is the build.hxml script that gets used to compile the Haxe to Flash:

-cp Source
-D LOCAL_TEST
-D haxe-boot
-D flash-use-stage
-swf-lib index.swf
-swf-version 9
-swf pdfbuilder.swf
-debug
PDFBuilder

I have tried to do a compile by creating a project using one of the sample projects (DisplayingABitmap) and replacing the code in the Source folder with the code that I am trying to port. But I have not managed to get this to compile yet.

My questions are as follows:

  1. Will it be possible to do a compile to Adobe AIR with minimal changes to the code?
  2. Would the functionality of loading data with AMFPHP work in AIR?
  3. Will the index.swf be able to be used as is, or would changes need to be made to this to work in AIR?
  4. How would I go about indicating in VSCode that index.swf library must be imported, as there is no build.hxml in my project.

Hi,
it will be hard to answer fully without in depth info but short answer:

  1. This is mainly change how you compile, relatively small changes will be needed here. What AIR targets are you interested ? Desktop, Mobile ?
  2. Yes it will work as it supports AIR
  3. Yes you should be able to use it but need more details about content as its important what version of swf it have as AIR have some minimal req
  4. You should have project.xml (if opnefl or lime is used) or *.hxml file somewhere in order to build project, or it was build purely from command line, but you can always create one for you.

Hi Hersir,

Thanks for the reply. I am only interested in Desktop targets, specifically Windows. Ok, great, glad that AMFPHP will work; that was one of my main concerns, because if it wasn’t supported that would have required a lot of reworking on the client and server.

I am not sure how to give details of the content, as I do not know much about Flex/Flash at this stage. The application was developed in about 2008 and has not had any upgrades of libraries since then. Here are some screenshots of the source folder if that helps at all.

Here is the source folder:
mxml 1

Here is the contents of the Flexlib folder:
mxml 2

And the containers subfolder:
mxml 3

And, lastly, here is the mx folder contents off the root:

Yes, I have a project.xml file (it is a copy of a OpenFL sample project). I have added this to my project.xml file:

and have placed the index.swf under the Assets folder. Is this correct?

OpenFL should migrate index.swf to the bin folder when you compile, so that part should be good.
You might be interested in this project: https://lib.haxe.org/p/Haxentric/
Looks like it might be a good option for porting your Flex code.