I am doing support for a company that has a business app written in haxe that compiles to Flash swf. The application is a layout generator that loads a list of items that can then be dragged onto the layout. The list of items are loaded from a PHP server using AMFPHP.
What we are looking at is porting this application to Adobe AIR so that we can continue using this application after 2020. After doing some research, I discovered the Lime/OpenFL VSCode extension and thought that the best route would be to try get the haxe code to compile to AIR using Lime. I have not had any experience with using haxe or with Flash or OpenFL development, so this is all very new to me, and I do not know to what extent this port is feasible. So my first question is very broad, but I am wanting to know if anyone has had experience with doing conversions like this, and who might be able to comment on the feasibility of this approach?
To give a bit more detail about the application, here is the build.hxml that gets used to compile the current Flash application:
-cp Source
-D LOCAL_TEST
-D haxe-boot
-D flash-use-stage
-swf-lib index.swf
-swf-version 9
-swf pdfbuilder.swf
-debug
PDFBuilder
The index.swf gets compiled separately using mxmlc and is just a number of components made using Flex. So my next question regarding this port is whether I would be able to include this index.swf as is when I compile to AIR?
I have Haxe 4.0 installed; I have created an OpenFL project in VSCode and have tried to compile it. I am getting a number of error messages, the main two being that the import of haxe.remoting.AMFConnection fails with a type not found error, and the application does not have a Main type, because the startup of a Flash application is clearly different.
I am not exactly sure how to change the startup; the current application startup is as follows:
class PDFBuilder {
// CONFIG
inline public static var _hostAddress = #if LOCAL_TEST 'http://212.45.52.43' #else '' #end;
inline public static var _hostLocalPath = 'C:/Inetpub/wwwroot';
public static var _userPath:String;
/** Reference to Main Flex Application object **/
public static var flex:Dynamic;
public static var app:PDFBuilder;
public static var event:PDFBuilderEvents;
public static var service = AMFConnection.urlConnect(#if LOCAL_TEST _hostAddress +
'/commonfiles/php/amfphp-1.2/gateway.php' #else 'amfphp-1.2/gateway.php' #end);
// Layout items container
public static var itemData:ItemData = new ItemData(updateItemTreeData);
public var grid:layout.Grid;
public var events:PDFBuilderEvents;
public var uploader:UploadManager;
public function main(_flex:Dynamic) {
app = this;
....
Lime I believe is expecting a Main class rather than a class name that reflects the name of the application (PDFBuilder), but I am sure there are more things that need to change besides the name of the class.
Use --library argument in your hxml file: https://haxe.org/manual/compiler-usage.html
For haxe4 I think you need to use air4 lib https://lib.haxe.org/p/air4haxe/