Compiling an Apollo application with the amxmlc compiler
Back to: Apollo Documentation home page
Compile the ActionScript and MXML assets of your Apollo application with the command-line MXML compiler (amxmlc):
amxmlc [compiler options] -- MyApolloApp.mxml
where [compiler options] specifies the command-line options used to compile your Apollo application.
The amxmlc command invokes mxmlc with an additional parameter, +configname=apollo, which instructs the compiler to use the apollo_config.xml file instead of the flex_config.xml file. Using amxmlc is otherwise identical to using mxmlc. The mxmlc compiler and the configuration file format are described in the Building and Deploying Flex 2 Applications book in the Flex 2 documentation library.
The compiler loads the apollo-config.xml configuration file specifying the Apollo and Flex libraries typically required to compile an Apollo application. You can also use a local, project-level configuration file to override or add additional options to the global configuration. Typically the easiest way to create a local configuration file is to edit a copy of the global version. You can load the local file with the -load-config option:
-load-config=project-config.xml-- overrides global options.-load-config+=project-config.xml-- adds additional values to those global options that take more than value, such as the -library-path option. Global options that only take a single value are overridden.
You can also use a special naming convention for the file and the amxmlc compiler will load the local configuration file automatically. For example, if your application’s main MXML file is RunningMan.mxml, then name the configuration file: RunningMan-config.xml. To compile the application you only need to type:
amxmlc RunningMan.mxml
Note: The compiler commands use relative paths to find configuration files and executables. You must install the Flex 2 and Apollo SDKs together for these commands to work. See Setting up your development environment.
Examples
Compile an Apollo MXML file:
amxmlc myApp.mxml
Compile and set the output name:
amxmlc –output anApp.swf -- myApp.mxml
Compile an Apollo ActionScript file:
amxmlc myApp.as
Specify a compiler configuration file:
amxmlc –load-config config.xml -- myApp.mxml
Add additional options from another configuration file:
amxmlc –load-config+=moreConfig.xml -- myApp.mxml
Add an additional libraries on the command line (to those already in the configuration file):
amxmlc –library-path+=/libs/libOne.swc,/libs/libTwo.swc -- myApp.mxml
Compile an Apollo MXML file without using a configuration file (Win):
mxmlc -library-path [Apollo SDK]/frameworks/libs/apollo/apolloframework.swc, ^ [Apollo SDK]/frameworks/libs/apollo/apolloframework.swc, ^ -library-path [Flex 2 SDK]/frameworks/libs/framework.swc ^ -- myApp.mxml
Compile an Apollo MXML file without using a configuration file (Mac OS X):
mxmlc -library-path [Apollo SDK]/frameworks/libs/apollo/apolloframework.swc, \ [Apollo SDK]/frameworks/libs/apollo/apolloframework.swc, \ -library-path [Flex 2 SDK]/frameworks/libs/framework.swc \ -- myApp.mxml
Compile an Apollo MXML file to use a runtime-shared library
amxmlc -external-library-path+=../lib/myLib.swc -runtime-shared-libraries=myrsl.swf -- myApp.mxml
Compiling from Java (with the class path set):
java flex2.tools.Compiler +flexlib [Flex SDK 2]/frameworks +configname=apollo [additional compiler options] -- myApp.mxml
The flexlib option identifies the location of your Flex SDK frameworks directory, enabling the compiler to locate the flex_config.xml file.
Compiling from Java (without the class path set):
java -jar [Flex SDK 2]/lib/mxmlc.jar +flexlib [Flex SDK 2]/frameworks +configname=apollo [additional compiler options] -- myApp.mxml
Note, only the ActionScript and MXML assets of your application need to be compiled.
Back to: Apollo Documentation home page