User Guide

FLVPlayback class 651
FLVPlayback.seek
Availability
Flash Player 8.
Edition
Flash Professional 8.
Usage
var listenerObject:Object = new Object();
listenerObject.seek = function(eventObject:Object):Void {
// insert event-handling code here
};
my_FLVplybk.addEventListener("seek", listenerObject);
Description
Event; dispatched when the location of playhead is changed by a call to seek(), by setting the
playheadTime property or by using the seekBar control. The playheadTime property is the
destination time. The event object has the properties
state, playheadTime, and vp, which is
the index number of the video player to which the event applies.
The FLVPlayback instance dispatches the
rewind event when the seek is backward and the
fastForward event when the seek is forward. It also dispatches the playheadUpdate event.
For several reasons, the
playheadTime property might not have the expected value
immediately after calling one of the seek methods or setting
playheadTime to cause seeking.
First, for a progressive download, you can seek only to a keyframe, so a seek takes you to the
time of the first keyframe after the specified time. (When streaming, a seek always goes to the
precise specified time even if the source FLV file doesnt have a keyframe there.) Second,
seeking is asynchronous, so if you call a seek method or set the
playheadTime property,
playheadTime does not update immediately. To obtain the time after the seek is complete,
listen for the
seek event, which does not start until the playheadTime property has updated.
Example
The following example seeks 2 seconds into the FLV file when the ready event occurs. The
seek() function triggers a seek event, at which point the listener displays the playheadTime
and the name of the FLVPlayback instance.