11 Debugging

No matter how experienced you get at writing code, there will be times when the code you write doesn't work the way you expect. Isolating and fixing the errors is called debugging and is a fascinating mental challenge, or a complete headache depending on how you are feeling that day! In this chapter we will look at many of the more common errors and look at techniques for isolating the problem and then fixing it.

Strings and Numbers

You have created a game that allows the user to input a numeric value using an input box. Then you run this code:

    on (release){

        num = num + userInput;

    }

You have a num of 14, and a userInput of 10. You expect the num to be set to 24; instead it is set to 1410. Why? Simple really, userInput ...

Get Flash MX 2004 Games 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.