ADOBE FLEX 3
• Creating static properties and methods
• Creating enumeration-like structures
• Defining and using interfaces
• Working with inheritance, including overriding class elements
Important concepts and terms
The following reference list contains important terms that you will encounter in this chapter:
• Attribute: A characteristic assigned to a class element (such as a property or method) in the class definition.
Attributes are commonly used to define whether the property or method will be available for access by code in other
parts of the program. For example,
private and public are attributes. A private method can be called only by code
within the class, while a public method can be called by any code in the program.
• Class: The definition of the structure and behavior of objects of a certain type (like a template or blueprint for
objects of that data type).
• Class hierarchy: The structure of multiple related classes, specifying which classes inherit functionality from
• Constructor: A special method you can define in a class, which is called when an instance of the class is created.
A constructor is commonly used to specify default values or otherwise perform setup operations for the object.
• Data type: The type of information that a particular variable can store. In general, data type means the same thing
• Dot operator: The period sign (.), which in ActionScript (and many other programming languages) is used to
indicate that a name refers to a child element of an object (such as a property or method). For instance, in the
myObject.myProperty, the dot operator indicates that the term myProperty is referring to some value
that is an element of the object named
• Enumeration: A set of related constant values, grouped together for convenience as properties of a single class.
• Inheritance: The OOP mechanism that allows one class definition to include all the functionality of a different
class definition (and generally add to that functionality).
• Instance: An actual object created in a program.
• Namespace: Essentially a custom attribute, allowing more refined control over which code can access other code.
A class is an abstract representation of an object. A class stores information about the types of data that an object can
hold and the behaviors that an object can exhibit. The usefulness of such an abstraction may not be apparent when
you write small scripts that contain only a few objects interacting with one another. As the scope of a program grows,
however, and the number of objects that must be managed increases, you may find that classes allow you to better
control how objects are created and how they interact with one another.
As far back as ActionScript 1.0, ActionScript programmers could use Function objects to create constructs that
resembled classes. ActionScript 2.0 added formal support for classes with keywords such as
class and extends.
ActionScript 3.0 not only continues to support the keywords introduced in ActionScript 2.0, but also adds some new
capabilities, such as enhanced access control with the
protected and internal attributes, and better control over
inheritance with the
final and override keywords.