Running and Debugging ActionScript and Flex Applications
In this section:
- Run/debug configuration types
- Running or debugging an application from within the editor
- How IntelliJ IDEA selects or creates a class-specific run/debug configuration
- Using Flash Remote Debug configurations
- Hiding or showing [SWF] and [UnloadSWF] debugger messages
Run/debug configuration types
The following run/debug configuration types are available for Flash modules:
- Flash App configurations let you compile and then run or debug your Flash (ActionScript and Flex) applications. You can create the necessary configurations prior to running or debugging. You can also start running or debugging an application right in the editor, when working with your source code (see Running or debugging an application from within the editor).
- FlexUnit configurations let you compile and then run or debug your FlexUnit tests. See Testing ActionScript and Flex Applications.
- Flash Remote Debug configurations let you debug applications that have already been compiled and, if necessary, packaged, and are ready to be run on a local or remote computer, or a mobile device. See Using Flash Remote Debug configurations.
To be able to debug your applications:
- The applications must be debug-ready, that is, contain the necessary debug information.
- For Web-targeted applications, you must install the debugger version of Flash player or
the debugger version of the Flash player plugin for your Web browser.
Normally, this software is included in Flex SDKs.
You can also download the corresponding software separately from the Adobe Flash Player Downloads page.
Running or debugging an application from within the editor
When working with the class source code in the editor, if appropriate, you can run or start debugging your application with the current class as the main application class. To do that, right-click somewhere in the editor area to open the context menu and select:
- Run "<class_name>" (Ctrl+Shift+F10) to run the application.
- Debug "<class_name>" to start debugging the application.
If a Flash App run/debug configuration appropriate for the task already exists, this configuration is selected and used. Otherwise, a new run/debug configuration is created and saved as a temporary run/debug configuration. For details, see How IntelliJ IDEA selects or creates a class-specific run/debug configuration.
- Create "<class_name>". If an appropriate run/debug configuration is not found, you can use this command to create a new run/debug configuration and make it current. (The Create Run/Debug Configuration dialog will open.)
- Save "<class_name>". If the corresponding run/debug configuration is available as a temporary configuration, you can use this command to save the configuration and thus make it permanent.
- Select "<class_name>". Use this command if you want to make the corresponding temporary or permanent run/debug configuration current.
How IntelliJ IDEA selects or creates a class-specific run/debug configuration
As already mentioned, when you run or debug your application from within the editor, IntelliJ IDEA first tries to find an existing run/debug configuration with the class you are currently working with as the main class.
If no such configuration is found, a new run/debug configuration is created.
If more than one configuration with the suitable main class is found, IntelliJ IDEA prioritizes the configurations according to the following conditions and select the one with the highest priority:
- The run/debug configuration is based on the active build configuration, the build configuration output type is Application, the main class is not overridden in the run/debug configuration.
- The run/debug configuration is based on a build configuration with the output type Application, the main class is not overridden in the run/debug configuration.
- The run/debug configuration is based on the active build configuration, the main class is overridden in the run/debug configuration.
- Any run/debug configuration with the suitable (overridden) main class.
When creating a new run/debug configuration, IntelliJ IDEA tries to find a build configuration with a suitable main class. If found, the new run/debug configuration will be based on such a build configuration. Otherwise, the active build configuration will be used, and the main class will be overridden in the new run/debug configuration.
Using Flash Remote Debug configurations
- Select and start the necessary Flash Remote Debug configuration ( or Shift+F9).
As a result, the Debug tool window opens; the debugger is waiting for the application to connect.
- Now, to connect to the debugger, do one of the following:
- Start the Flash or AIR application on your local computer; the application will connect to the debugger automatically.
- If the application is already running in a Web browser or a Flash player on the local or remote computer, right-click the corresponding page in the browser or the application in the player, and select Debugger from the context menu.
- Start the application on the mobile device. If the device is capable of communicating with your computer, the application will connect to the debugger automatically.
Hiding or showing [SWF] and [UnloadSWF] debugger messages
You can hide or show the
by using on the toolbar.
Note that changing the state of this toggle doesn't change the current console content. That is, if you turn the filter on, the messages already present in the output won't be hidden. Only new messages won't be shown.