Chapter 20. Using the AVM2 Debugger

Introduction

In this chapter

  • Launching the Debugger

  • Stopping your program to examine it

  • Viewing variables in scope

  • Using the call stack

  • Moving around your program

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 there is no mystery to your code.

When you compile your ActionScript 3.0 program, it turns into a series of very simple instructions called bytecodes that are interpreted by the ActionScript Virtual Machine 2, or 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. ...

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.