Chapter 17. Debugging and Tuning the Application

 <  Day Day Up  >  

Debugging and tuning an application has always been one of the most frustrating aspects of Flash development. Thankfully, ActionScript 2.0 now displays detailed error messages explaining exactly what is wrong, which goes a long way to helping debug applications. If we as developers remember to type all of our Objects and Functions, Flash will also perform type checking which will display many more error messages than in earlier versions of Flash. Just by using ActionScript 2.0, debugging an application becomes much easier because much more detailed error messages are displayed to the developer.

In this unit, we will explore how to improve on the debugging capabilities of ActionScript. We will examine the usefulness of the trace statement which is still one of the most important tools in Flash debugging. However, one of the most frustrating aspects of using the trace statement is the fact that it can be difficult to view complex data structures. For example, if we view an Array of Objects using the native trace function in Flash, we often just see [Object Object] and Flash does not display the data structure, as shown in Figure 17.1.

Figure 17.1. Viewing a complex data structure, an Array of Objects with the trace function.


To remedy this, we will greatly improve the trace functionality and build a class that will dump out complex data structures and display these to the Flash developer because that functionality is not native to Macromedia Flash MX 2004. This class will be invaluable in debugging any application that uses complex data. In addition, ActionScript 2.0 offers new exception-handling capabilities that make finding specific errors in our code much easier. We will explore the exception handling and the new ActionScript 2.0 commands try , catch , finally , and throw .

 <  Day Day Up  >  

Object-Oriented Programming with ActionScript 2.0
Object-Oriented Programming with ActionScript 2.0
ISBN: 0735713804
EAN: 2147483647
Year: 2004
Pages: 162 © 2008-2017.
If you may any questions please contact us: