User Guide

Classes 113
Dynamic classes generally return the value undefined instead of generating an error when
code external to a class attempts to access a private property. The following table shows that
an error is generated only when the dot operator is used to access a private property in strict
mode:
The
protected attribute, which is new for ActionScript 3.0, makes a property visible to
callers within its own class or in a subclass. In other words, a protected property is available
within its own class or to classes that lie anywhere below it in the inheritance hierarchy. This is
true whether the subclass is in the same package or in a different package.
For those familiar with ActionScript 2.0, this functionality is similar to the
private attribute
in ActionScript 2.0. The ActionScript 3.0
protected attribute is also similar to the
protected attribute in Java, but differs in that the Java version also permits access to callers
within the same package. The
protected attribute is useful when you have a variable or
method that your subclasses needs but that you want to hide from code that is outside the
inheritance chain.
The
internal attribute, which is new for ActionScript 3.0, makes a property visible to callers
within its own package. This is the default attribute for code inside a package, and it applies to
any property that does not have any of the following attributes:
public
private
protected
a user-defined namespace
The
internal attribute is similar to the default access control in Java, although in Java there
is no explicit name for this level of access, and it can be achieved only through the omission of
any other access modifier. The
internal attribute is available in ActionScript 3.0 to give you
the option of explicitly signifying your intent to make a property visible only to callers within
its own package.
static attribute
The static attribute, which can be used with properties declared with the var, const, or
function keywords, allows you to attach a property to the class rather than to instances of the
class. Code external to the class must call static properties using the class name instead of an
instance name.
Strict mode Standard mode
dot operator (.) compile-time error
undefined
bracket operator ([])
undefined undefined