FLVPlayback.complete

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
    // insert event-handling code here
};
my_FLVplybk.addEventListener("complete", listenerObject);

Description

Event; dispatched when playing completes because the player reached the end of the FLV file. The component does not dispatch the event if you call the stop() or pause() methods or click the corresponding controls. The event object has the properties state and playheadTime.

When the application uses progressive download, does not set the totalTime property explicitly, and downloads an FLV file that does not specify the duration in the metadata, the video player sets totalTime to an approximate total value before it dispatches this event.

The video player also dispatches the stateChange and stopped events.

Example

The following example uses the playheadTime property to show the elapsed playing time of the FLV file in the Output panel when the complete event occurs.

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.*;
var listenerObject:Object = new Object();
listenerObject.complete = function(eventObject:Object):Void {
    trace("Elapsed play time at completion is: " + my_FLVPlybk.playheadTime);
};
my_FLVPlybk.addEventListener("complete", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";

See also

FLVPlayback.playheadTime, FLVPlayback.state, FLVPlayback.stateChange, FLVPlayback.stopped, FLVPlayback.totalTime