ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.playheadTime | |||
Flash Player 8.
Flash Professional 8.
my_FLVPlybk.playheadTime
Property; a number that is the current playhead time or position, measured in seconds, which can be a fractional value. Setting this property triggers a seek and has all the restrictions of a seek.
When the playhead time changes, which includes once every .25 seconds while the FLV file plays, the component 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 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 fire until the playheadTime property has updated.
The following example catches occurrences of the stateChange event as it occurs while the FLV file plays and shows the elapsed playhead time in the Output panel.
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.stateChange = function(eventObject:Object):Void {
trace(my_FLVPlybk.state + ": playhead time is: " + my_FLVPlybk.playheadTime);
};
my_FLVPlybk.addEventListener("stateChange", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
FLVPlayback.playheadUpdate, FLVPlayback.playheadUpdateInterval, FLVPlayback.seek(), FLVPlayback.stateChange
|
|
|
|