User Guide

160 Chapter 4: Writing and Debugging Scripts
Caution: If you set breakpoints in the Actions panel and press the Auto Format button, you might
notice that some breakpoints are no longer in the correct location. ActionScript might be moved to a
different line when your code is formatted because sometimes empty lines are removed. It might be
necessary to check and modify your breakpoints after you click Auto Format, or to auto format your
scripts before setting breakpoints.
To set or remove a breakpoint in the Actions panel during a debugging session:
Do one of the following:
Click in the left margin. A red dot indicates a breakpoint.
Click the Debug options button above the Script pane.
Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select
Set Breakpoint, Remove Breakpoint or Remove All Breakpoints.
Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).
Note: In previous versions of Flash, clicking in the left margin of the Script pane selected the line of
code; now it adds or removes a breakpoint. To select a line of code, use Control-click (Windows) or
Command-click (Macintosh).
To set and remove breakpoints in the Debugger:
Do one of the following:
Click in the left margin. A red dot indicates a breakpoint.
Click the Toggle Breakpoint or Remove All Breakpoints button above the code view.
Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select
Set Breakpoint, Remove Breakpoint, or Remove All Breakpoints.
Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).
After Flash Player stops at a breakpoint, you can step into, over, or out of that line of code.
Note: Do not set breakpoints on comments or empty lines; if breakpoints are set on comments or
empty lines, they are ignored.
Stepping through lines of code
When you start a debugging session, Flash Player is paused so that you can toggle breakpoints. If
you set breakpoints in the Actions panel, you can simply click the Continue button to play the
SWF file until it reaches a breakpoint. If you didnt set breakpoints in the Actions panel, you can
use the jump menu in the Debugger to select any script in the SWF file. When you have selected
a script, you can add breakpoints to it.
After adding breakpoints, you must click the Continue button to start the SWF file. The
Debugger stops when it reaches the breakpoint. For example, in the following code, suppose a
breakpoint is set inside a button on the line
myFunction():
on(press){
myFunction();
}