ActionScript 3.0 Support


#1

OpenFL 8.1 is here, and introduces beta support for ActionScript 3.0 as a source language!

We’d love additional feedback on how we can improve the workflow in our samples.

To get started, enter any of the samples, run npm install then npm start.

We expect to continue to work with Apache Royale until we can bring the workflow up to par with our other supported source languages on NPM (Haxe, TypeScript, ES5 JavaScript, ES6 JavaScript).

Thanks for your support, feedback and help!

OpenFL 8.1 is available on both NPM and Haxelib. Though this is primarily an NPM feature-based release, there are some minor fixes for the Haxelib release as well :grin:


#2

Good!But how to use openfl test html5 way to test?


#3

I know how to test it, but I’m not quite sure how to use npm to generate an apk?


#4

Great! Is it only for flash, html5 and Air target? Or is it possible to target also windows, linux, neko…?


#5

It uses NPM currently, but ActionScript sources could also use Adobe AIR to generate an APK, the same way you would normally.

This is not currently using the openfl tools, so npm install then npm start -s is the way to test one of these samples


#6

If you want to target HTML5, then we support Haxe, JavaScript, TypeScript and (now) ActionScript 3.0 as input languages. This uses NPM for linking tools together.

If you want to target Flash or Adobe AIR targets (Android, iOS, Windows, macOS) then there already are Adobe-based workflows for using ActionScript 3.0.

It’s also worth mentioning you can use HTML5 + Electron to build desktop applications using all of the above languages.

Lastly, if you want to target HTML5, Flash, AIR, Android, iOS, Windows, macOS, Linux, WebAssembly, consoles and other targets using the OpenFL tools, Haxe is the only supported language today.


#7

Can I use starling on npm? Haxe original library can support it?


#8

We just released starling-framework@2.3.3 on NPM, which supports ActionScript 3.0, now!

You can check it out by doing the following (assuming you have NPM and Java installed):

git clone https://github.com/openfl/starling
cd starling/samples/demo_npm/as3
npm install
npm start -s

If you’re using Visual Studio Code, you should be able to open that “as3” folder and be able to use the “ActionScript & MXML” extension for a better development experience


#9

The “cpx assets/**/. bin/js-debug/assets” command looks like an anomaly. Remove the build dev, but not the assets.


#10
"scripts": {
    "build": "npm run build:dev",
    "build:dev": "cpx 'assets/**/*.*' bin/js-debug/assets && cpx node_modules/openfl/dist/openfl.min.js bin/js-debug && cpx node_modules/howler/dist/howler.min.js bin/js-debug && cpx node_modules/starling-framework/dist/starling.min.js bin/js-debug && cpx node_modules/pako/dist/pako.min.js bin/js-debug && asconfigc --debug=true",
    "build:prod": "cpx 'assets/**/*.*' bin/js-release/assets && cpx node_modules/openfl/dist/openfl.min.js bin/js-release && cpx node_modules/howler/dist/howler.min.js bin/js-release && cpx node_modules/starling-framework/dist/starling.min.js bin/js-release && cpx node_modules/pako/dist/pako.min.js bin/js-debug && asconfigc --debug=false",
    "start": "npm run start:dev",
    "start:dev": "npm run build:dev && royale serve:debug",
    "start:prod": "npm run build:prod && royale serve:release"
  }

After the reference command, “cpx ‘assets/**/.’ bin/js-debug/assets” is required to work properly.


#11
[Error] TypeError: undefined is not an object (evaluating 'b.prototype')
	v (Main.js:4:246)
	全局代码 (Main.js:6:986)
[Error] ReferenceError: Can't find variable: Main
	全局代码 (localhost:40)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (starling.min.js.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (openfl.min.js.map, line 0)

When using Release to release the official version, the above exception will be reported.


#12

Does the dev build work?


#13

Yes, the dev build can work


#14

Okay, so one approach might be stage.addChild (new Main ()) instead of passing by reference. There is still more work to do here to integrate more fully with Closure Library, which Royale uses