Compiling for deployment

When you create a deployable SWF file, ensure that you compile the application correctly. Typically, you disable certain compiler features, such as the generation of debug output, and enable other options, such as the generation of accessible content.

This section contains an overview of some common compiler options that you might use when you create a deployable SWF file. For a complete list of compiler options, see Flex compilers.

Creating a release build of your application in Flash Builder

When you create and run an application in Flash Builder, the Flex compiler includes debug information in that application so that you can set breakpoints and view variables and perform other debugging tasks. However, the SWF file that Flash Builder generates by default includes debugging information that makes it larger than the release build of the SWF file.

To create a release build of your application in Flash Builder, select Project > Export Release Build. This compiles a version of your application’s SWF file that does not contain any debug information in it. This SWF file is smaller than the SWF files you compile normally. This also compiles any modules that are in the application’s project without debug information.

In general, all compiled SWF files that are stored in the project’s /bin-debug directory contain debug information. When you export the application, you choose a new output directory. The default is the /bin-release directory.

To compile a release build on the command line, set the debug compiler option to false. This prevents debug information from being included in the final SWF file.

Enabling accessibility

The Flex accessibility option lets you create applications that are accessible to users with disabilities. By default, accessibility is disabled. You enable the accessibility features of Flex components at compile time by using options to a Flash Builder project, setting the accessible option to true for the command-line compiler, or setting the <accessible> tag in the flex-config.xml file to true.

For more information on creating accessible applications, see Accessible applications.

Preventing users from viewing your source code

Flex lets you publish your source code with your deployed application. You might want to enable this option during the development process, but disable it for deployment. Or, you might want to include your source code along with your deployed application.

In Flash Builder, the Export Release Build wizard lets you specify whether to publish your source code. You can also use the viewSourceURL property of the Application class to set the URL of your source code.

Disabling incremental compilation

You can use incremental compilation to decrease the time it takes to compile an application or component library with the Flex application compilers. When incremental compilation is enabled, the compiler inspects changes to the bytecode between revisions and only recompiles the section of bytecode that has changed.

For more information, see Flex compilers.

Using a headless server

A headless server is one that is running UNIX or Linux and often does not have a monitor, keyboard, mouse, or even a graphics card. Headless servers are most commonly encountered in ISPs and ISVs, where available space is at a premium and servers are often mounted in racks. Enabling the headless mode reduces the graphics requirements of the underlying system and can allow for a more efficient use of memory.

If you deploy a Flex application on a headless server, you must set the headless-server option of the compiler to true. Setting this option to true is required to support fonts and SVG images in a nongraphical environment.