Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 111

Programming actionscript 3.0
Table of Contents

Advertisement

}
// In your script
var myST:StaticTest = new StaticTest();
trace(StaticTest.message); // static variable
trace(myST.message);
Class property attributes
In discussions of the ActionScript object model, the term property means anything that can be
a member of a class, including variables, constants, and methods. This differs from the way
the term is used in the ActionScript 3.0 Language Reference, where the term is used more
narrowly and includes only class members that are variables or are defined by a getter or setter
method. In ActionScript 3.0, there is a set of attributes that can be used with any property of
a class. The following table lists this set of attributes.
Attribute
(default)
internal
private
protected
public
static
UserDefinedNamespace
Access control namespace attributes
ActionScript 3.0 provides four special attributes that control access to properties defined
inside a class:
public
The
attribute makes a property visible anywhere in your script. For example, to make
public
a method available to code outside its package, you must declare the method with the
attribute. This is true for any property, whether it is declared using the
keywords.
function
The
attribute makes a property visible only to callers within the property's defining
private
class. This behavior differs from that of the
allowed a subclass to access a private property in a superclass. Another significant change in
behavior has to do with run-time access. In ActionScript 2.0, the
prohibited access only at compile time, and was easily circumvented at run time. In
ActionScript 3.0, this is no longer true. Properties that are marked as
at both compile time and run time.
// instance variable
Definition
Visible to references inside the same package.
Visible to references in the same class.
Visible to references in the same class and derived classes.
Visible to references everywhere.
Specifies that a property belongs to the class, as opposed to
instances of the class.
Custom namespace name defined by user.
,
,
private
protected
, and
.
internal
attribute in ActionScript 2.0, which
private
public
,
, or
var
const
keyword
private
are unavailable
private
Classes
111

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents