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:

on(press){
	myFunction();
}

When you click the button, Flash Player reaches the breakpoint and pauses. You can now bring the Debugger to the first line of myFunction() wherever it is defined in the document. You can also continue through or exit out of the function.

As you step through lines of code, the values of variables and properties change in the Variables, Locals, Properties, and Watch tabs. A yellow arrow on the left side of the Debugger’s code view indicates the line at which the Debugger stopped. Use the following buttons along the top of the code view:

Step In 

Advances the Debugger into a function. (If a line does not contain a user-defined function, Step In advances to the next line.)

In the following example, if you place a breakpoint at line 7 and click Step In, the Debugger advances to line 2, and another click of Step In advances you to line 3.


1 function myFunction() {
2 x = 0;
3 y = 0;
4 }
5
6 mover = 1;
7 myFunction();
8 mover = 0;
Note: The numbers in this code snippet denote line numbers. They are not part of the code.
Step Out 

Advances the Debugger out of a function. This button works only if you are currently stopped in a user-defined function; it moves the yellow arrow to the line that follows the function call. In the previous example, if you place a breakpoint at line 3 and click Step Out, the Debugger moves to line 8. Clicking Step Out at a line that is not within a user-defined function is the same as clicking Continue. For example, if you stop at line 6 and click Step Out, the player continues to execute the script until it encounters a breakpoint.


Step Over 

Advances the Debugger over a line of code. This button moves the yellow arrow to the next line in the script. In the previous example, if you are stopped at line 7 and click Step Over, you advance directly to line 8 without stepping through myFunction(), although the myFunction() code still executes.


Continue 

Leaves the line at which the player is stopped and continues playing until a breakpoint is reached.


End Debug Session 

Makes the Debugger inactive but continues to play the SWF file in Flash Player.


  This page on the Web