The application compilers create SWF files that are run in an Adobe™ Flash® Player client or in an Adobe AIR™ application. The client can be a stand-alone Flash Player or a Flash Player in a browser, which takes the form of an ActiveX control for Microsoft Internet Explorer or a plug-in for Netscape-based browsers.
Flex Builder
project compiler.
The Flex Builder application compiler is opened by Flex Builder for Flex Projects and ActionScript Projects. (The component compiler is used for Library Projects.) It is similar in functionality to the mxmlc command-line compiler, although the way you set options is different. You use this compiler to compile Flex Builder projects that you will later deploy. For more information, see Using the Flex Builder application compiler.
The mxmlc command-line compiler.
You open the mxlmc compiler from the command line to create a SWF file that you then deploy to a website. Typically, you pass the name of the application's root MXML file to the compiler. The output is a SWF file. For more information, see Using the mxmlc application compiler.
Web-tier compiler.
The Flex module for Apache and IIS compiler provides web-tier compilation of MXML files on Apache and IIS web servers. This lets you rapidly compile, test, and deploy an application: instead of compiling your MXML file into a SWF file and then deploying it and its wrapper files on a web server, you can just refresh the MXML file in your browser. For more information, see Using the Flex Module for Apache and IIS.
The Flex Builder compiler and mxmlc compiler have similar sets of options. These are described in About the application compiler options.
You can compile applications that are written entirely in ActionScript and contain no MXML. You can compile these "ActionScript-only" applications with the Flex Builder and mxmlc compilers. You cannot compile ActionScript-only applications with the web-tier compiler. This compiler requires that there be at least a root application MXML file.
You use the Flex Builder application compiler to create SWF files from MXML, ActionScript, and other source files. You use this compiler to precompile SWF files that you deploy later, or you can deploy them immediately to a server running the Flex web application.
To open the Flex Builder application compiler, you select Project > Build. The Flex Builder application compiler is opened by Flex Builder for Flex Projects and ActionScript Projects. (You use the component compiler for Library Projects.)
To edit the compiler settings, use the settings on the Project > Properties > Flex Compiler dialog box. For information on the compiler options, see About the application compiler options.
The Flex Builder compiler has the same options as the mxmlc compiler. Some options are implemented with GUI controls in the Flex Compiler dialog box. To set the source path and library options, select Project > Properties > Flex Build Path and use the Flex Build Path dialog box.
You can set the values of most options in the Additional Compiler Arguments field by using the same syntax as on the command line. For information about the syntax for setting options in the Flex Compiler dialog box, see About the command-line compilers.
By default, Flex Builder exposes the compilation options through the project properties. If you want to use a configuration file, you can create your own and pass it to the compiler by using the load-config option. For more information on setting compiler options with configuration files, see About configuration files.
In addition to generating SWF files, the Flex Builder compiler also generates an HTML wrapper that you can use when you deploy the new Flex application. The HTML wrapper includes the <object> and <embed> tags that reference the new SWF file, as well as scripts that support history management and player version detection. For more information about the HTML wrapper, see Creating a Wrapper.
The Flex Builder application compiler uses incremental compilation by default. For more information on incremental compilation, see About incremental compilation.
You use the mxmlc command-line compiler to create SWF files from MXML, AS, and other source files. You can open it as a shell script and executable file for use on Windows and UNIX systems. You use this compiler to precompile Flex applications that you deploy later.
The command-line compiler is installed with Flex SDK. It is in the flex_install_dir/bin directory in Flex SDK. The compiler is also included in the default Flex Builder installation, in the flex_builder_install_dir/sdks/sdk_version/bin directory.
To use the mxmlc utility, you should understand its syntax and how to use configuration files. For more information, see About the command-line compilers.
The basic syntax of the mxmlc utility is as follows:
mxmlc [options] target_file
The default option is the target file to compile into a SWF file, and it is required to have a value. If you use a space-separated list as part of the options, you can terminate the list with a double hyphen before adding the target file; for example:
mxmlc -option arg1 arg2 arg3 -- target_file.mxml
To see a list of options for mxmlc, you can use the help list option, as the following example shows:
mxmlc -help list
To see a list of all options available for mxmlc, including advanced options, you use the following command:
mxmlc -help list advanced
The default output of mxmlc is filename.swf, where filename is the name of the root application file. The default output location is in the same directory as the target, unless you specify an output file and location with the output option.
The mxmlc command-line compiler does not generate an HTML wrapper. You must create your own wrapper to deploy a SWF file that the mxmlc compiler produced. The wrapper is used to embed the SWF object in the HTML tag. It includes the <object> and <embed> tags, as well as scripts that support Flash Player version detection and history management. For information about creating an HTML wrapper, see Creating a Wrapper.
The mxmlc utility uses the default compiler settings in the flex-config.xml file. This file is in the flex_sdk_dir/frameworks/ directory. You can change the settings in this file or use another custom configuration file. For more information on using configuration files, see About configuration files.
The mxmlc compiler is highly customizable with a large set of options. For information on the compiler options, see About the application compiler options.
You can also open the mxmlc compiler with the java command on the command line. For more information, see Invoking the command-line compilers with Java.