You can use the methods in the Events category of the MovieClip object to handle movie clip events. You must define a function and assign it to the event handler method. Without a function assigned to it, the event handler method has no effect on the movie.
You can either call an event handler method from the instance of the movie clip whose event you want to handle, or create a new ActionScript class and define the methods in the prototype object of the class. (For more information, see Defining event handler methods in a class definition.)
To use a movie clip event handler method to trigger a script:
object
parameter, enter the target path for the movie clip whose event you want to handle.The following code defines a function for the onPress
method of the instance mc
that sets the _alpha
property of mc
when mc
loads:
mc.onPress = function() { this._alpha = 50; };
Note: The keyword this
refers to the instance that calls the event handler method. In this example, the instance is mc
.