FLVPlayback.seekPercent()

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

my_FLVplybk.seekPercent(percent:Number)

Parameters

percent A number that specifies a percentage of the length of the FLV file at which to place the playhead.

Returns

Nothing.

Description

Method; seeks to a percentage of the file and places the playhead there. The percentage is a number between 0 and 100.

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 doesn't 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 disables the FLV file from playing automatically. When the FLV file is ready, it sets the playhead 30 percent into the playing time and begins playing at that point.

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.autoPlay = false;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object) {
    my_FLVPlybk.seekPercent(30);
    my_FLVPlybk.play();
}
my_FLVPlybk.addEventListener("ready", listenerObject);

See also

FLVPlayback.seek, FLVPlayback.seek(), FLVPlayback.seekSeconds()