Chapter 6. Debugging Flex Applications


Outputting Values to the Console Using trace()

Inspecting Event Properties with trace()

Using Breakpoints


Butch Cassidy: “I’ll jump first.” Sundance Kid: “Nope.” Butch Cassidy: “Then you jump first.” Sundance Kid: “No, I said!” Butch Cassidy: “What’s the matter with you?!” Sundance Kid: “I can’t swim!” Butch Cassidy: “Why, you crazy...the fall will probably kill ya!”

Paul Newman Robert Redford Butch Cassidy and the Sundance Kid

By now, you’re probably comfortable enough with Flex basics to have created a few experimental interfaces. To be a real code mechanic, though, you also need some techniques to inspect what’s happening under the hood. It’s called debugging. No doubt you’ve heard the term before, and your first impressions are probably close enough. Debugging is troubleshooting, and troubleshooting is tedious.

Fortunately Flash Builder includes some tools to simplify your debugging routines, and this chapter teaches you how to use them. We’ll discuss use of the trace() statement to preview variable values, how to pause and inspect code logic using breakpoints, and how to benefit from Flash Builder’s Debugging perspective.

The goal of debugging is testing variables and functions to ensure they result in the values you expected when you first created them. By its very name, debugging implies that there’s a bug—or glitch—in your software that you need to locate. As you’ll see, however, there’s more to debugging than that. ...

Get Learning Flex 4 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.