User Guide
FLVPlayback class 679
Example
The following example listens for the playheadUpdate event, and when the elapsed
playheadTime is greater than or equal to 5 seconds, the listener calls the stop() method to
stop playing the FLV file. A second listener listens for the
stopped event and displays the
values of the
playheadTime and state properties.
Drag an FLVPlayback component to the Stage, and give it an instance name of
my_FLVPlybk. Then add the following code to the Actions panel on Frame 1 of the
Timeline:
/**
Requires:
- FLVPlayback component on the Stage with an instance name of my_FLVPlybk
*/
import mx.video.*;
my_FLVPlybk.autoRewind = false;
var listenerObject:Object = new Object();
listenerObject.stopped = function(eventObject:Object):Void {
trace("playhead time is: " + eventObject.playheadTime);
trace("The video player state is: " + eventObject.state);
};
my_FLVPlybk.addEventListener("stopped", listenerObject);
listenerObject.playheadUpdate = function(eventObject:Object):Void {
if (eventObject.playheadTime >= 5) {
my_FLVPlybk.stop();
}
};
my_FLVPlybk.addEventListener("playheadUpdate", listenerObject);
my_FLVPlybk.contentPath ="http://www.helpexamples.com/flash/video/
water.flv";
See also
FLVPlayback.pause(), FLVPlayback.play()
FLVPlayback.stopButton
Availability
Flash Player 8.
Edition
Flash Professional 8.
Usage
my_FLVPlybk.stopButton