FLVPlayback.playheadPercentage

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

my_FLVPlybk.playheadPercentage

Description

Property; a number that specifies the current playheadTime as a percentage of the totalTime property. If you access this property, it contains the percentage of playing time that has elapsed. If you set this property, it causes a seek operation to the point representing that percentage of the FLV file's playing time.

The value of this property is relative to the value of the totalTime property.

The component throws a VideoError if you specify a percentage that is invalid or if the totalTime property is undefined, null, or less than or equal to zero.

Example

The following example displays the percentage of the FLV file that has played when the point2 cue point occurs. At the point3 cue point, it sets playheadPercentage to 10, causing a seek operation to the point that is 10 percent from the beginning of the FLV file and creating a playback loop.

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.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv";
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
        if(eventObject.info.name == "point2")
            trace("point2 occurred at " + my_FLVPlybk.playheadPercentage + " percent of FLV");
        if(eventObject.info.name == "point3")
            my_FLVPlybk.playheadPercentage = 10;
}
my_FLVPlybk.addEventListener("cuePoint", listenerObject);

See also

FLVPlayback.playheadTime, FLVPlayback.seekPercent(), FLVPlayback.totalTime