Debugging Adobe® Flex® applications can be as simple as enabling trace() statements or as complex as stepping into an application's source files and running the code, one line at a time. The Adobe® Flex® Builder™ debugger and the command-line debugger, fdb, let you step through and debug the files used by your Flex applications.
To debug a Flex application, you must generate a debug SWF file. This is a SWF file with debug information in it. You then connect fdb to the debugger version of Adobe® Flash® Player that is running the debug SWF file.
The debugger is an agent that communicates with the application that is running in Flash Player. It connects to your application with a local socket connection. As a result, you might have to disable anti-virus software to use it if your anti-virus software prevents socket communication. The debugger uses this connection to transfer information from the SWF file to the command line so that you can add breakpoints, inspect variables, and do other common debugging tasks. The port through which the debugger connects to your application is 7935. You cannot change this port.
This topic describes how to use the fdb command-line debugger. To use the Flex Builder debugger, see Running and Debugging Applications in Using Adobe Flex Builder 3.To use either debugger, you must install and configure the debugger version of Flash Player. To determine if you are running the debugger version or the standard version of Flash Player, open any Flex application in the player and right-click the mouse button. If you see the Show Redraw Regions option, you are running the debugger version of Flash Player. For more information about the debugger version of Flash Player, and how to detect which player you are running, see Using the debugger version of Flash Player.
The fdb command-line debugger is located in the flex_install_dir/bin directory. To start fdb, open a command prompt, change to that directory, and enter fdb.
For a description of available commands, use the following command:
(fdb) help
For an overview of the fdb debugger, use the following command:
(fdb) tutorial
To debug a Flex application, you first generate a debug SWF file. Debug SWF files are similar to other application SWF files except that they contain debugging-specific information that the debugger and the debugger version of Flash Player use during debugging sessions. Debug SWF files are larger than non-debug SWF files, so generate them only when you are going to debug with them.
To generate the debug SWF file using the mxmlc command-line compiler, you set the debug option to true, either on the command line or in the flex-config.xml file. The following example sets the debug option to true on the command line:
mxmlc -debug=true myApp.mxml
Flex Builder generates debug SWF files by default in the project's /bin-debug directory. To generate a non-debug SWF file in Flex Builder, you use the Export Release Build feature. This generates a non-debug SWF file in the project's /bin-release directory. You can also manually set the debug compiler option to false in the Additional Compiler Arguments field of the project's properties.
To generate the debug SWF file using the web-tier compiler with the Flex module for Apache and IIS, you can either set the debug compiler option to true or append debug=true on the query string:
http://www.yourdomain.com/MyApp.mxml?debug=true
For more information, see Invoking the debugger compiler.
The command-line debugger supports debugging only at the ActionScript level and does not support the Flash timeline concept. The debugger also does not support adding breakpoints inside script snippets in MXML tags. You can set breakpoints on event handlers defined for MXML tags.
Flash Player may interact with a server. The debugger does not assist in debugging the server-side portion of the application, nor does it offer support for inspecting any of the IP transactions that take place from Flash Player to the server, and vice versa.
You can open commands within the fdb debugger by using the fewest number of nonambiguous keystrokes. For example, to use the print command, you can type p, because no other command begins with that letter.
When you debug an application in a web browser, fdb opens the player in the default browser. The default browser is the browser that opens when you open a web-specific file without specifying an application. You must also have the debugger version of Flash Player installed with this browser. If you do not have the debugger version of Flash Player, Flash displays an error indicating that your Flash Player does not support all fdb commands.
Your default browser might not be the first browser that you installed on your computer. For example, if you installed another web browser after installing Microsoft Internet Explorer, Internet Explorer might not be your default browser.
Determine your default browser
http://www.adobe.com
Windows opens the default browser or displays an error message indicating that there is no application configured to handle your request.
Set Internet Explorer 6.x as your default browser
The next time you start Internet Explorer, Internet Explorer prompts you to make it the default browser. If you are not prompted, Internet Explorer is already your default browser.
Set Firefox as your default browser
The next time you start FireFox, FireFox prompts you to make it the default browser. If you are not prompted, FireFox is already your default browser.
Each application can have any number of ActionScript files. Some of the files that fdb steps into are external class files, and some are generated by the Flex compilers.
In general, Flex generates a single file that contains ActionScript statements used in <mx:Script> blocks in the root MXML file, and an additional file for each ActionScript class that the application uses. Flex generates many source files so that you can navigate the application from within the debugger.
To view a list of files that are used by the application you are debugging, use the info files command. For more information, see Getting status.
The generated ActionScript class files are sometimes referred to as compilation units. For more information about compilation units, see About incremental compilation.