
491 CHAPTER 23 Debugging and testing
■
Breakpoints —Points at which you want the application to stop running so you
can pause and evaluate the situation.
■
Expressions —All the variables you indicated you want to watch
With the Debugger enabled, let’s proceed to working with breakpoints.
ADDING/REMOVING A BREAKPOINT
You can add a breakpoint anywhere you have ActionScript. For instance, you can add
a breakpoint to inline ActionScript in an
MXML tag:
<mx:Button click="myVar=myText.text"/>
You can also place a breakpoint inside an
<mx:Script>
block or in an ActionScript
(.as) file.
To do this, follow these steps:
1 Using Flex Builder, locate a line of code on which you want to halt execution.
2 Right-click in the marker bar (where the line numbers are displayed).
3 Select Toggle Breakpoint.
To remove the breakpoint, repeat the same steps.
If all goes well, you should see your breakpoint listed in the Breakpoints view, as
shown in figure 23.3.
With the Debugger launched and breakpoints set, you can control the execution of
your application.
CONTROLLING EXECUTION
After you’ve set your breakpoints, launch your application in Debug mode. As soon as
you hit the line that has a breakpoint, execution will stop and Flex Builder will want
your attention.
You can use Debug view to control what happens next by using the functions out-
lined in table 23.4.
Figure 23.3 Set
breakpoints show up in
the Breakpoints view.
Comentarios a estos manuales