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 ...
Get ActionScript 3.0 Bible now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.