Learning ActionScript 2.0 in Adobe Flash |
|
|
|
| Classes > About object-oriented programming and Flash > About packages > A comparison of classes and packages | |||
In OOP, a class defines a category of object. Classes are essentially data types that you can create if you want to define a new type of object in your application. A class describes the properties (data) and behaviors (methods) for an object, much like an architectural blueprint describes the characteristics of a building. The properties (variables defined within a class) and methods of a class are collectively called the class's members. To use the properties and methods defined by a class, you generally first create an instance of that class (except for classes that have all static members (see About class (static) members, such as the top-level Math class, and Static methods and properties). The relationship between an instance and its class is similar to the relationship between a house and its blueprints.
Packages in Flash are directories that contain one or more class files and reside in a designated file path. You might place related custom class files within a single directory. For example, you might have three related classes called SteelWidget, PlasticWidget, and WoodWidget that are defined in SteelWidget.as, PlasticWidget.as, and WoodWidget.as. You would organize these classes in the Widget package. For more information on packages, see Working with packages and Creating and packaging your class files.
|
|
|
|