User Guide
520 Chapter 6: Components Dictionary
When the event is triggered, it automatically passes an event object (eventObject) to the
handler. Each event object has properties that contain information about the event. You can use
these properties to write code that handles the event. The
Media.change event’s event object has
two additional properties:
target A reference to the broadcasting object.
type The string "change", which indicates the type of event.
For more information, see “EventDispatcher class” on page 415.
Example
The following example uses an object listener to determine the playhead position
(
Media.playheadTime), from which the percentage complete can be calculated:
var myPlayerListener = new Object();
myPlayerListener.change = function(eventObject){
var myPosition = myPlayer.playheadTime;
var myPercentPosition = (myPosition/totalTime);
}
myPlayer.addEventListener("change", myPlayerListener);
See also
Media.playing
, Media.pause()
Media.click
Applies to
MediaController, MediaPlayback
Availability
Flash Player 7.
Edition
Flash MX Professional 2004.
Usage
listenerObject = new Object();
listenerObject.click = function(eventObject){
// insert your code here
}
myMedia.addEventListener("click", listenerObject)
Description
Event; broadcast when the user clicks the Play/Pause button. The detail field can be used to
determine which button was clicked. The
Media.click event object has the following properties:
detail The string "pause" or "play".
target A reference to the MediaController or MediaPlayback instance.
type The string "click".