O'Reilly logo

Learning Flex 4 by Elijah Robison, Alaric Cole

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using Breakpoints

In this section we discuss how to use breakpoints to pause your application while you examine control properties and variable values.

A breakpoint is a position in the logic of your code where you’d like to stop everything and conduct an inspection. Some programming constructs can get quite complicated, so it’s useful to say, “Halt!” and then review the current status of one or many variables. Breakpoints allow you to do just that—pause and take a look.

To create a breakpoint, simply double-click a line number in your code editor where you want to suspend your application. To test this, we’ll create two breakpoints, one inline with doAdd() and the other inline with doMultiply(); see Figure 6-3. We’ll also need to restore the change method of our NumericStepper to call onChange() once again, shown in Example 6-7.

Breakpoints created to interrupt the two math functions in DebugApp

Figure 6-3. Breakpoints created to interrupt the two math functions in DebugApp

Example 6-7. Restoring the onChange() function to test breakpoints

<s:NumericStepper id="myNS" minimum="1" maximum="100"
    change="onChange()"/>

Note

Breakpoints will stop your application before any code on that line is processed. Therefore, it’s best to place breakpoints on the same line calling a function so you can inspect variable values both before and after they are changed by a problematic routine.

At this point, you’re ready to launch the application in Debug mode. Whenever the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required