User Guide
Using cue points 517
Adding ActionScript cue points
You can add ActionScript cue points to an FLV file using the addASCuePoint() method. The
following example adds two ActionScript cue points to the FLV file when it is ready to play. It
adds the first cue point using a cue point object, which specifies the time, name, and type of
the cue point in its properties. The second call specifies the time and name using the method’s
time and name parameters.
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/
cuepoints.flv"
var cuePt:Object = new Object(); //create cue point object
cuePt.time = 2.02;
cuePt.name = "ASpt1";
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, "ASpt2");
For more information, see FLVPlayback.addASCuePoint() on page 552.
Listening for cuePoint events
The cuePoint event allows you to receive control in your ActionScript code when a
cuePoint event occurs. When cue points occur in the following example, the cuePoint
listener calls an event handler function that displays the value of the
playheadTime property
and the name and type of the cue point.
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
trace("Elapsed time in seconds: " + my_FLVPlybk.playheadTime);
trace("Cue point name is: " + eventObject.info.name);
trace("Cue point type is: " + eventObject.info.type);
}
my_FLVPlybk.addEventListener("cuePoint", listenerObject);
For more information on the cuePoint event, see FLVPlayback.cuePoint on page 580.
Finding cue points
Using ActionScript, you can find a cue point of any type, find the nearest cue point to a time,
or find the next cue point with a specific name.