Apache Royale Compiler

Turn your source code into compiled output

Apache Royale provides a compiler (some call it a transpiler or cross-compiler) and a command-line debugger to turn your source code into compiled output you can share with users. The compiler takes AS3, MXML, and CSS as inputs.

The main output of the compiler is JavaScript. The compiler can also output SWFs for the Adobe Flash and AIR runtimes. There is some initial work on Web Assembly output.

It is relatively straightforward to add additional output formats to the compiler.

The code is based on the ActionScript Compiler 2.0 that Adobe donated to Apache. The SWF output was pretty much working at the time of donation. Volunteers working on the Apache Flex and Royale projects have created the JavaScript output code.

User Guide

The Royale Compiler does many things besides compile MXML and ActionScript into JavaScript and/or SWF. But if that’s all you want to do, you can use the compiler with Apache Maven, Apache Ant, asconfigc, several IDEs, npm and through the command-line. Below are some pointers to getting started:

Apache Maven

There are some examples in the apache/royale-asjs repo in the examples folder. The pom.xml files should be useful as a starting point. There are also Maven archetypes available in Apache Royale releases.

Apache Ant

In an Apache Royale distribution, there is a compiler-royaleTasks.jar in the js/lib folder that contains Ant tasks for the Royale Compiler. There is an mxmlc task for creating applications and a compc task for creating libraries.

asconfigc

asconfigc is a command line tool for compiling ActionScript projects and is arguably the easiest way to compile – especially if you are not familiar with Apache Ant or Maven. asconfigc can be run a stand-alone command line tool, or as part of a VS Code extension. To run it, you would either feed arguments into the tool or more likely create a asconfig.json file at the base of your project. Refer to the documentation for the full list of options.

IDEs

Consult your IDE documentation for how to launch the Royale Compiler. You can generate an IDE distribution from Apache Maven and/or Apache ANT.

NPM

Both mxmlc or compc should be available on the system path to run from the command line after installing Royale via npm. Use mxmlc --help to see the list of available compiler options.

Command line

The js/bin folder should contain mxmlc and compc scripts that will launch the compiler. Use mxmlc --help to see the list of available compiler options.

Compiler Options

Royale provides several compiler options to customize the use. You can check the list of compiler options here:

Read about how to contribute to the Apache Royale Compiler.