7 The Anatomy of a Class
The SimpleSquare class from Chapter 6 is a very simple example of a class, but it has all of the most important elements. Like all classes it exists in an external file, which in this case is called, “SimpleSquare.as”. More importantly, it has the necessary structure that allows Flash to know what to do with it. Every class has at least the following elements:
- A class declaration.
- A number of property declarations.
- A constructor method declaration.
- A number of method declarations.
These elements can be seen in Listing 7.1.
The first thing you will notice is the class declaration:
class ch6.SimpleSquare ...