Apache Royale Formatter

Format your .as and .mxml source files

User Guide

Below are some pointers to help you get started with the Apache Royale formatter in various environments. This tool can format both MXML and ActionScript 3.0 (AS3).

Command line

The bin directory of the Royale SDK should contain the asformat script that will launch the formatter. Use asformat --help to see a list of available formatter options.

To use the default formatting options, simply pass in the path to a .as or .mxml file as an argument.

asformat src/com/example/MyClass.as

The formatted file contents will be printed to the standard output only, and the original file will remain unmodified. To save the formatting changes, use the --write-files option (or its shorter -w alias).

asformat --write-files src/com/example/MyClass.as

To format multiple files, pass in a directory path. The formatter will search this directory recursively for .as and .mxml files, and it will format every one that it finds.

asformat --write-files src

To see which files were changed by the formatter, use the --list-files option (or its shorter -l alias).

asformat --write-files --list-files src

Editors and IDEs

Consult your editor or IDE documentation to see whether it integrates the Royale formatter or not. Many development environments have the ability to run external command line programs, even if the Royale formatter is not directly integrated.

Formatter configuration

The Royale formatter provides a number of command line options to customize its use. You can also save a list of the options for your project in a local configuration file that will be detected automatically.