|
this
Availability
Flash Player 5.
Usage
this
Description
Keyword; references an object or movie clip instance. When a script executes, this references the movie clip instance that contains the script. When a method is called, this contains a reference to the object that contains the called method.
Inside an on event handler action attached to a button, this refers to the Timeline that contains the button. Inside an onClipEvent event handler action attached to a movie clip, this refers to the Timeline of the movie clip itself.
Example
In the following example, the keyword this references the Circle object.
function Circle(radius) {
this.radius = radius;
this.area = Math.PI * radius * radius;
}
In the following statement assigned to a frame, the keyword this references the current movie clip.
// sets the alpha property of the current movie clip to 20
this._alpha = 20;
In the following statement inside an onClipEvent handler, the keyword this references the current movie clip.
// when the movie clip loads, a startDrag operation
// is initiated for the current movie clip.
onClipEvent (load) {
startDrag (this, true);
}
See also
new
|