Understanding how projects are built

When your Flex and ActionScript projects are built, a release and debug version of your application SWF files are placed in the project output folder along with the HTML wrapper files. (Flex Data Services projects may be compiled by Flex Builder or on the server when accessed). When a Flex library project is built, a SWC file is generated.

The debug version of your application contains debugging information and is used when debugging your application. The release version does not include the additional debugging information and is therefore smaller in size than the debug version. An HTML wrapper file contains a link to the application SWF file and is used to run or debug your application in a web browser. In a standard Flex application, a typical output folder resembles the following example.


Typical output folder

You can run or debug your Flex and ActionScript applications either in a web browser or in the stand-alone Flash Player. You control how your applications are run or debugged by modifying the project's launch configuration (see Running your applications). For more information about running and debugging your applications, see Running and Debugging Applications.

When you use Flex Data Services, you create Flex applications that leverage the Flex server technologies. When building Flex Data Services applications, you have the option of compiling the output files locally using Flex Builder or on the server when the application is first accessed.

Build basics

MXML and ActionScript 3.0 are compiled languages. Unlike interpreted languages such as JavaScript that can be immediately executed by their run-time environments, MXML and ActionScript 3.0 must be converted into a compiled format before they can be executed by Flash Player. This process, along with the generation of related output files, is called building.

Flex Builder automatically builds your projects whenever a file in your project is changed and saved. While you have the option of building your applications manually, this should not be necessary; however, understanding the build process and the output files that are generated will help you to diagnose and repair project configuration problems that may arise.

Flex projects Source files and embedded assets (such as images) are compiled into a single output format called SWF, which is a file that can be run directly in the stand-alone Flash Player or in a web browser via an HTML wrapper file that is also generated by the build. These files are generated into the project's output folder (by default, this is named 'bin' but you can name it anything you like).

Flex Data Services projects When using Flex Data Services. you have the option of creating projects that are compiled on the server. When the MXML application file is first accessed (through a web browser), it is compiled into a SWF file.

It's important to note that even though you can configure FDS projects to be compiled on the server, Flex Builder compiles these projects as you're developing your applications so that the compiler can validate code syntax and display error messages. These projects have no output folder option and Flex Builder does not generate output files.

ActionScript 3.0 projects Like Flex projects, ActionScript 3.0 projects compile source files and embedded assets into a SWF file.

Flex library projects A library project's source files are components and related resources. When library projects are built, a SWC file is generated into the output folder. Archived into the SWC file is a SWF file containing the components and resources and a catalog.xml file that is the manifest of the elements contained within the SWF file.

Automatic builds

In the standalone configuration of Flex Builder, your applications are built automatically. In the plug-in configuration, you must select the Build Automatically option yourself. While you have the option of building your applications manually, as mentioned above, this should not be necessary. It's important to keep in mind that turning off automatic builds also prevents the compiler from identifying syntax errors and displaying warning and error messages as you enter code. In other words, you won't get any feedback in the Problems view until the project is compiled; therefore, it's best to set Flex Builder to build automatically. For more information, see Advanced build options.

Advanced project build options

Using advanced build options, you can control the timing and scope of your builds. For example, you can build a single project, all projects in the workspace, or create a working set (a collection) of projects to build. All build commands are accessible from the Project menu, as shown in the following example. For more information, see Advanced build options.


Project menu

The Flex Builder compiler is incremental, building only those resources that have been added or affected by updates and ignoring all others. This saves time and system resources. You have the option, however, to rebuild all the resources in the project. You do this by performing a clean build. You might do this if your application is behaving erratically during testing and you want to eliminate all potential sources of the problem by discarding and rebuilding all the files in your project. For more information, see Advanced build options.

If you create dependencies between separate projects in the workspace, the compiler automatically determines the order in which the projects are built, so these dependencies resolve properly. You can, however, override the default build order and manually set the order in which the projects in your workspace are built. For more information, see Building projects manually.

You can also modify the build path, application list, and compiler settings for each project in the workspace. For more information, see Building projects manually, Managing project application files and Advanced build options.

Build errors displayed in the Problems view

Errors encountered by the compiler during builds appear in the Problems view, which is included in the development and debugging perspectives, and in the code editor, where lines of code containing errors are marked with an x.


Problems view

For more information about working with the Problems view, see Using the Problems view.

Custom build scripts with Apache Ant

You can modify and extend the standard build process by using Apache Ant, which is an open-source Java-based build tool.

For more information about creating custom builders, see Customizing builds with Apache Ant.

Command line access to the Flex 2 framework compilers

You have direct command line access to use the Flex 2 framework compilers (mxmlc and compc). When you install Flex Builder, the Flex framework prompt is available from the Windows start menu (Programs > Adobe). For more information, see "About the command-line compilers in Building and Deploying Flex 2 Applications.

Learn more about building projects in Flex Builder

If you haven't already done so, review the getting started lesson Create Your First Application in the Getting Started with Flex 2. For more information, see the following topics:


Flex 2.01

Take a survey