User Guide
FLVPlayback class 581
Example
The following example adds two ActionScript cue points to an FLV file. The example adds
the first one using a
cuePoint parameter and the second one using the time and name
parameters. When each cue point occurs, a listener for
cuePoint events shows the value of the
playheadTime property in a text area.
Drag an FLVPlayback component to the Stage, and give it an instance name of
my_FLVPlybk. Drag a TextArea component to the Stage below the FLVPlayback instance,
and give it an instance name of my_ta. 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
- TextArea component on the Stage with an instance name of my_ta
*/
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/
water.flv";
my_ta.visible = false;
// create cue point object
var cuePt:Object = new Object(); //create cue point object
cuePt.time = 1.444;
cuePt.name = "elapsed_time";
cuePt.type = "actionscript";
my_FLVPlybk.addASCuePoint(cuePt); //add AS cue point
// add 2nd AS cue point using time and name parameters
my_FLVPlybk.addASCuePoint(5.3, "elapsed_time2");
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
my_ta.text = "Cue at: " + eventObject.info.time + " occurred";
my_ta.visible = true;
}
my_FLVPlybk.addEventListener("cuePoint", listenerObject);
See also
FLVPlayback.activeVideoPlayerIndex, FLVPlayback.visibleVideoPlayerIndex