Set and remove breakpoints

A breakpoint lets you stop a Flash application at a specific line of ActionScript. You can use breakpoints to test possible trouble spots in your code. For example, if you’ve written a set of if..else if statements and can’t determine which one is executing, you can add a breakpoint before the statements and examine them one by one (step through them) in the Debugger.

You can set breakpoints in the Actions panel, Script window, or Debugger. Breakpoints set in the Actions panel are saved with the FLA file. Breakpoints set in the Debugger and Script window are not saved in the FLA file and are valid only for the current debugging session.

Important: If you set breakpoints in the Actions panel or Script window and click Auto Format, check your breakpoints. If the Auto Format command removed empty lines, your ActionScript might be moved to a different line. It’s a good idea to autoformat your scripts before you set breakpoints.

You can view breakpoints in both the Debugger and the Script window by setting them in either one of those windows. For this to work, the path to the AS file must be the same in both windows.

Do not set breakpoints on comments or empty lines; these breakpoints are ignored.

Set or remove a breakpoint in the Actions panel or Script window

During a debugging session, do one of the following:

  • Click in the left margin of the Script pane. A red dot indicates a breakpoint.

  • Click Debug Options button.

  • Right-click (Windows) or Control-click (Macintosh) to display the context menu, and select Set Breakpoint, Remove Breakpoint, or Remove Breakpoints In This File. (In the Script window, you can also select Remove Breakpoints In All AS Files.)

  • Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).

    Note: In some 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).

Set and remove breakpoints in the Debugger

  • Click in the left margin of the code pane. A red dot indicates a breakpoint.
  • Click Toggle Breakpoint or Remove All Breakpoints 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 in the File.
  • Press Control+Shift+B (Windows) or Command+Shift+B (Macintosh).

The breakpoints XML file

When you work with breakpoints in the Script window, the AsBreakpoints.xml file lets you store breakpoint information. This file is written to the Local Settings directory, in the following locations:

Windows

Hard Disk\Documents and Settings\User\Local Settings\Application Data\Adobe\Flash CS3\language\Configuration\Debugger\


Macintosh

Macintosh HD/Users/User/Library/Application Support/Adobe Flash CS3/Configuration/Debugger/

Here is an example of an AsBreakpoints.xml file:


<?xml version="1.0"?>
<flash_breakpoints version="1.0">
	<file name="c:\tmp\myscript.as">
		<breakpoint line="10"></breakpoint>
		<breakpoint line="8"></breakpoint>
		<breakpoint line="6"></breakpoint>
	</file>
	<file name="c:\tmp\myotherscript.as">
		<breakpoint line="11"></breakpoint>
		<breakpoint line="7"></breakpoint>
		<breakpoint line="4"></breakpoint>
	</file>
</flash_breakpoints>

The XML file consists of the following tags:

flash_breakpoints

This node has a version attribute, which specifies the version of the XML file. Flash 8 is version 1.0.


file

A child node of flash_breakpoints. This node has a name attribute, which specifies the name of the file that contains breakpoints.


breakpoint

A child node of file. This node has a line attribute, which specifies the line number that contains the breakpoint.

The AsBreakpoints.xml file is read when you start Flash, and regenerated when you quit. AsBreakpoints.xml is used to keep track of the breakpoints between development sessions.


  This page on the Web