Chapter 5. Validating Your Program

No matter how careful you are when writing code, you will almost certainly run into one or two errors. Don't worry; it happens to everyone, including myself every day. Being able to see error messages is a real blessing. Errors are your friends, in a way. Your goal should always be to strive for error-free code, but error messages are the best way to tell when there's something wrong that you may not have noticed. Think of it like a spell-checker. Compiling and running your code and checking for errors frequently is the best way to catch problems before they multiply.

Flash Player has not only a robust system for handling errors but support for interactive debuggers, both of while I'll cover in detail in Part V, "Error Handling." However, since you should be starting to play with the example code that you'll see more and more of, it's a good time to stop and talk about some of the kinds of bugs you're likely to run into and what to do about them.

Introducing Errors

Errors are messages generated by the compiler or runtime that let you know something has gone wrong.

Tip

A feature in the AS3 compiler allows you to set whether you want the compiler to interpret your code using Strict mode or not. Strict mode, the default setting, allows you to compile your code using more rigorous compile-time type checking. It checks to see that all classes, methods, and properties are valid before allowing the program to compile — hence, it's more strict. This makes debugging ...

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.