Running applications

When you test your applications in Adobe® Flash® Builder™, you run the application SWF files in a web browser or the stand-alone Flash Player. If you encounter errors in your applications, you use the debugging tools to set and manage breakpoints in your code; control application execution by suspending, resuming, and terminating the application; step into and over the code statements, select critical variables to watch, and evaluate watch expressions while the application runs.

About running and debugging applications

After your projects are built into applications (see Building projects), you can run and debug them in Flash Builder.

Use debugger version of Flash Player

To use the Flash Builder debugging feature, you must run the debugger version of Flash Player. This version is available as a browser plug-in or ActiveX control, or as a stand-alone version. This is the version that is installed with Flash Builder, but it is also available as a download from the Adobe web site.

The installers for the debugger version of Flash Player are located in the flex_builder_install/Player directory.

You can programmatically determine which version of Flash Player you are running by using the Capabilities.isDebugger() method. For more information, see Determining Flash Player version in Flex.

Use launch configurations to run and debug applications

A launch configuration defines the project name, main application file, and the path to the run and debug versions of the application. Flash Builder contains a default Flex application launch configuration that is used to create launch configurations automatically for each of your projects. For more information, see Managing launch configurations.

Note: In the plug-in configuration of Flash Builder, a launch configuration is not automatically created for you. You need to create one the first time you run your application. See Running your applications.

Customize launch configurations

You can customize the launch configurations that Flash Builder creates automatically for you. For example, you can switch the main application file or modify the path to point to the SWF file rather than the HTML wrapper file so that you can run and debug your applications directly in the stand-alone Flash Player instead of a web browser. You can also create separate launch configurations for each of the application files in your project. For more information, see Creating or editing a launch configuration.

Run and debug applications in a browser or the stand-alone Flash Player

By default, the launch configuration specifies that the run and debug paths point to the HTML wrapper files in the output folder of your project; therefore, your applications are run and debugged in Flash Player running in a web browser. Instead you can run and debug your applications in the stand-alone Flash Player (see Running the application SWF file in the stand-alone Flash Player). You can also override the system default web browser setting and run your applications in any browser you have installed (see Changing the default web browser).

Note: The default security settings for Internet Explorer 6 (or later) block applications launched from Flash Builder. You can change your Internet Explorer security settings by selecting Tools > Internet Options > Advanced > Security > Allow active content to run in files on My Computer. Or you can explicitly allow each Internet Explorer page to run after it is blocked.

Run debugging tools from the code editor

The Flash Debug perspective provides all the debugging tools you expect from a robust, full-featured development tool. The debugging tools allow you to:

  • Set and manage breakpoints

  • Determine how to suspend, resume, and terminate the application

  • Step into and over code

  • Watch variables

  • Evaluate expressions

For more information about the Flash Builder debugging tools, see Debugging your applications.

For more information about code editing, see About code editing in Flash Builder.

Activate the Debugging perspective at a breakpoint

You add breakpoints to executable lines of code in the code editor. When you begin a debugging session, the application runs until the first breakpoint is hit. The Flash Debug perspective is then activated and you can inspect the state of and manage the application by using the debugging tools. For more information, see Starting a debugging session.

Compare debug and non-debug versions of your Flex application

By default, Flash Builder generates debug versions of your Flex application’s SWF file and stores them in your project’s bin-debug directory. This application is larger than the non-debug version because it includes additional code and metadata that the debugger uses.

To generate a non-debug version of your Flex application, you can do one of the following:

  • Select Project > Export Release Build. This creates a non-debug SWF file or AIR file in the bin-release directory.

  • Add -debug=false to the Additional Compiler Arguments field. This generates a non-debug SWF file no matter where you export it to.

Running your applications

Your applications are run (and debugged) based on a launch configuration. When you create new Flex and ActionScript applications, a launch configuration specifies the location of the built applications files and the main application file. You can modify the launch configuration or create custom launch configurations. For more information, see Managing launch configurations.

Running your projects opens the main application SWF file in your default web browser or directly in the stand-alone Flash Player. For information about changing the default web browser or running and debugging with the stand-alone Flash Player, see Changing the default web browser and Running the application SWF file in the stand-alone Flash Player.

You can run your projects in a number of ways in Flash Builder. For example, you can use the Run command, which is available from the workbench main menu and toolbar, from the Flex Package Explorer, and code editor pop-up menus.

Note: The Run button has two elements: the main action button, and a pop-up menu that shows the application files in the project that can be run or debugged. When you click the main action button, the default application file is run. Alternatively you can click the pop-up menu and select any of the application files in the project and create or edit a launch configuration in the Create, Manage, and Run Configurations dialog box.

Run project with default Flex application launch configuration

  1. In the Flex Package Explorer, select the project to run.

  2. On the main workbench toolbar, click the Run button.

    If your project is not built yet, Flash Builder builds and runs it.

    Your application appears in your default web browser or the stand-alone Flash Player.

You can run and debug any project files that have been set as application files. For more information see Managing project application files.

Create custom launch configuration

  1. In the Flex Package Explorer, select the project you want to run and open the main application file in the editor.

  2. From the main menu, select Run > Run > Other.

  3. In the Create, Manage, and Run Configurations dialog box, select either Web Application or Desktop Application.

  4. Click the New button on the dialog box toolbar.

  5. Enter the launch configuration name.

  6. (Optional) Modify the configuration properties as needed.

  7. (Optional) Click Run to run the application.

Run other application files in your project

  1. In the Flex Package Explorer, select the project to run.

  2. From the main menu, select Run > Run > Other.

  3. Select the application you want to run.

Run a custom launch configuration

 From the main menu, select Run > Run > Other.

In the Create, Manage, and Run Configurations dialog box, select an existing custom launch configuration or create a new one. See Managing launch configurations.

The Run command works a bit differently in the plug-in configuration of Flash Builder. Instead of running the currently selected project, it runs the most recently launched configuration. You can also select from a list of recently launched configurations.

Run the last launched configuration

 Click the Run button on the main toolbar.

Managing launch configurations

Launch configurations are used both to run and to debug applications. Flash Builder provides a default launch configuration for Flex and ActionScript applications. When you first run or debug a project, a project-specific launch configuration is created. You edit the launch configuration to change the default main application file. You can also modify the default launch path to run or debug in the stand-alone Flash Player rather than in a web browser.

Creating or editing a launch configuration

When you create and build a project, it is ready to be run or debugged. Both running and debugging of the applications in your project are controlled by a launch configuration. By default, Flash Builder creates a launch configuration for each of the application files in your project the first time you run or debug them. The configurations are based on the default Flex application configuration, and you can edit them as necessary.

Launch configurations are managed in the Create, Manage, and Run Configurations dialog box.

Access and edit a launch configuration

  1. In the Flex Package Explorer, select a project.

  2. With a project file open in the code editor, open the Create, Manage, and Run Configurations dialog box. The way to do this depends on your Flash Builder installation.

    • Stand-alone Flash Builder: Select the project and then select Run > Run > Other or Run > Debug > Other.

    • Flash Builder plug-in with Eclipse 3.2: Right-click (Control-click on Macintosh) to display the context menu and select Run As > Run or Debug As > Debug.

    • Flash Builder plug-in with Eclipse 3.3: Right-click (Control-click on Macintosh) to display the context menu and select Run As > Open Run Dialog or Debug As > Open Debug Dialog.

  3. Select the launch configuration to edit.

    A number of configurations may be listed if you have other projects in the workspace, if you have set other project files as application files, or if other Eclipse plug-ins are installed.

    By default, the first time you run a project, Flash Builder creates a project-specific launch configuration, which is based on the default Flex application launch configuration.

    You can edit application-specific configurations. You can also create new a launch configuration or base a new configuration on an existing configuration.

  4. Modify the configuration preferences as needed, and click Run or Debug.

Creating launch configurations for desktop applications

You can create launch configurations for desktop applications to override the default configurations provided by Flash Builder.

When you create or edit a launch configuration for a desktop application, you specify command line arguments, a Publisher ID, a profile and screen size parameters.

For desktop applications, Profile can be either desktop or extendedDesktop.

To create a launch configuration:

  1. Select Run > Run > Other.

    For Debug launch configurations, specify Run > Debug > Other.

    For Profile launch configurations, specify Run > Profile > Other.

  2. Select the desktop project. Click the New Launch Configuration button.

    Specify the configuration settings in the Main, Source, or Common tabs.

  3. Select Run, Debug, or Profile to run the application with those settings.

    Click Close to save the settings.

Running the application SWF file in the stand-alone Flash Player

Your applications are run or debugged in the default web browser. You can change the default web browser to use run and debug applications (see Changing the default web browser). You can also choose to run and debug your applications in the stand-alone Flash Player by making a simple change to the launch configuration.

Run and debug applications in the stand-alone Flash Player

  1. From the Create, Manage, and Run Configurations dialog box, select the launch configuration you want to modify.

  2. In the Main tab, deselect Use Defaults.

  3. In either or both of the Run and Debug paths, click Browse.

    The file selection dialog box appears and lists the contents of the build output folder.

  4. Select the application SWF file in the bin-debug directory. Do not select the SWF file in the bin-release directory, if there is one. This SWF file does not contain debug information.

  5. Click Open to select the file and return to the configuration dialog box.

  6. Apply your changes and use the modified configuration to run or debug the application.

Changing the default web browser

Flash Builder uses the system default web browser when running and debugging applications. While you cannot set each launch configuration to use a specific web browser, you can change the workbench web browser setting, which affects how all of your applications are run and debugged.

Change the default web browser

  1. Open the Preferences dialog and select General > Web Browser.

  2. Select a web browser from the list of web browsers installed on your system.

    Note: The Use Internal Web Browser option does not apply to running and debugging applications. Applications are always run and debugged in an external web browser.

    You can also add, edit, and remove browsers from the list.

  3. Click OK to apply your changes.