Chapter 5. Validating Your Program

Introduction

In this chapter

  • Understanding errors

  • Dealing with common compile‐time and runtime errors

No matter how careful you are when writing code, you will almost certainly have one or two errors. Don't worry, it happens to everyone. In fact, even we, the authors of this very book, deal with errors every time we sit down to code. It's really nothing to be embarrassed about, and as you'll soon realize, being able to see error messages is a real blessing. Errors are your friends . . . well, sort of. 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 your code and checking for errors frequently is the best way to catch problems before they multiply.

ActionScript 3.0 has added a significantly improved system for identifying and handling errors. Debugging your code, or working out the errors, is easier than ever. We'll talk more about errors and logging later on in the book but for now we'll focus on some of the most common bugs and how to fix them.

Introducing Errors

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

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.