Stepping through lines of code – Adobe Flash Professional CS3 User Manual

Page 412

Advertising
background image

FLASH CS3

User Guide

406

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 infor-
mation. 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.

Stepping through lines of code

After you set breakpoints in a script and click Continue in the Debugger, you can step through lines of code—that
is, control how the Debugger moves through statements and functions.

For example, in the following ActionScript 2.0 code, suppose a breakpoint is set inside a button on the

myFunction()

line:

Advertising