O'Reilly logo

ActionScript 3.0 Bible by Roger Braunstein

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

Chapter 25. Using the AVM2 Debugger

Every builder needs the right tools for the job, and with ActionScript 3.0 comes a much-improved tool for correcting problems: an interactive debugger. With effective use of the debugger, you can locate and correct problems in your code intelligently, without hunting or head-scratching.

Introducing Debugging

An interactive debugger performs lots of different jobs. The net effect is that you can run your program in a controlled environment and interactively follow its execution. Without a debugger, executing code is like running an experiment with tiny particles: because you can't see them, you have to rely on secondary or tertiary effects of your experiment to determine what's really going on. You must carefully craft situations in which you can measure the outcome and attempt to support your theory with the data. When you have a debugger, it's like having a powerful microscope: you can see everything in perfect detail, and make primary observations rather than deducing cause-and-effect; it removes the mystery from your code.

When you compile your ActionScript 3.0 program, it turns into a series of simple instructions called bytecodes that are interpreted by the ActionScript Virtual Machine 2 (AVM2). When you run the program in Flash Player, it's those bytecodes that are being interpreted; the system doesn't know or care what you originally wrote in AS3 code. But when you compile your SWF with debugging information and use the debugger, you can watch ...

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