Testing a movie > Using the Debugger > Stepping through lines of code |  |

Stepping through lines of code

When you start a debugging session, the Flash Player is paused. If you set breakpoints in the Actions panel, you can simply click the Continue button to play the movie until it hits a breakpoint. For example, in the following code, suppose a breakpoint is set inside a button on the line myFunction():

    on(press){
    	myFunction();
    }

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

If you didn't set breakpoints in the Actions panel, you can use the jump menu in the Debugger to select any script in the movie. Once you've selected a script, you can add breakpoints to it. After adding breakpoints, you must click the Continue button to start the movie. The Debugger stops when it reaches the breakpoint.

As you step through lines of code, the values of variables and properties change in the Watch list and in the Variables, Locals, and Properties tabs. A yellow arrow along 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 (indicated by the yellow arrow) into a function. Step In works only for user-defined functions.

In the following example, if you place a breakpoint at line 7 and click Step In, the Debugger advances to line 2, and a subsequent click of Step In will advance you to line 3. Clicking Step In for lines that do not have user-defined functions in them advances the Debugger over a line of code. For example, if you stop at line 2 and choose Step In, the Debugger advances to line 3, as in the following example:

    1 function myFunction() {
    2þþþþx = 0;
    3þþþþy = 0;
    4 }
    5
    6 mover = 1;
    7 myFunction();
    8 mover = 0;

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 after the one where that function was called. In the example above, 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 executing 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 and ignores any user-defined functions. In the example above, if you are stopped at line 7 and click Step Over, you go directly to line 8, and the function `myFunction` is called in the process.

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

Stop Debugging makes the Debugger inactive, but continues to play the movie in the Flash Player.