
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
59
Chapter 4
CHAPTER 4
Classes
This chapter covers the syntax and theory behind classes in ActionScript 2.0 and
assumes a prior basic understanding of the concepts discussed in Chapter 2. Classes
are the foundational structure of all object-oriented programs, making them argu-
ably the most important aspect of OOP. As such, classes are predictably intricate.
This chapter is correspondingly lengthy and detailed but, even so, newer program-
mers can use it to learn the basics of creating and using classes.
If this is your first real exposure to programming with classes, you may want to con-
centrate on the first few pages of each of the following sections:
• “Defining Classes”
• “Constructor Functions (Take 1)”
• “Properties”
• “Methods”
• “Completing the Box Class”
Then you can dive right into Chapter 5, which shows, step-by-step, how to create a
real-world class in the Flash authoring environment. We’ll address the big-picture
questions in Chapter 5. (I decided to cover the syntax and mechanics first so you’d
have a strong foundation moving forward.)
Just remember to return to the present chapter whenever you need detailed refer-
ence material on implementing and using classes in ActionScript 2.0.
Defining Classes
A class is a template for the creation of objects (or, synonymously, instances ...