Adobe FLEX 2-PROGRAMMING ACTIONSCRIPT 3.0 Manual page 132

Programming actionscript 3.0
Table of Contents

Advertisement

...
}
Other types of events require unique properties not available in the Event class. These events
are defined using subclasses of the Event class so that new properties can be added to the
properties defined in the Event class. An example of such a subclass is the MouseEvent class,
which adds properties unique to events associated with mouse movement or mouse clicks,
such as the
mouseMove
MouseEvent class that shows the definition of properties that exist on the subclass, but not on
the base class:
public class MouseEvent extends Event
{
public static const CLICK:String
public static const MOUSE_MOVE:String = "mouseMove";
...
public function get stageX():Number {}
public function get stageY():Number {}
...
}
Access control specifiers and inheritance
If a property is declared with the
This means that the
public
keywords, places no restrictions on property inheritance.
If a property is declared with
which means that it is not inherited by any subclasses. This behavior is different from previous
versions of ActionScript, where the
keyword.
protected
The
keyword indicates that a property is visible not only within the class that
protected
defines it, but also to all subclasses. Unlike the
language, the
protected
other classes in the same package. In ActionScript 3.0, only subclasses can access a property
declared with the
protected
whether the subclass is in the same package as the base class or in a different package.
To limit the visibility of a property to the package in which it is defined, use the
keyword or do not use any access control specifier. The
the default access control specifier that applies when one is not specified. A property marked
as
will be inherited only by a subclass that resides in the same package.
internal
132
Object-Oriented Programming in ActionScript
and
events. The following example is an excerpt from the
click
keyword, the property is visible to code anywhere.
public
keyword, unlike the
keyword, it is visible only in the class that defines it,
private
private
keyword in ActionScript 3.0 does not make a property visible to all
keyword. Moreover, a protected property is visible to a subclass
= "click";
,
private
protected
keyword behaved more like the ActionScript 3.0
keyword in the Java programming
protected
internal
, and
internal
internal
access control specifier is

Advertisement

Table of Contents
loading

This manual is also suitable for:

Flex

Table of Contents