ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > Using cue points > Using ActionScript with cue points > 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.
The ready event handler in the following example calls the findCuePoint() method to find the cue point ASpt1 and then calls the findNearestCuePoint() method to find the navigation cue point that is nearest to the time of cue point ASpt1:
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv"
var rtn_obj:Object = new Object(); //create cue point object
my_FLVPlybk.addASCuePoint(2.02, "ASpt1"); //add AS cue point
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object):Void {
rtn_obj = my_FLVPlybk.findCuePoint("ASpt1");
traceit(rtn_obj);
rtn_obj = my_FLVPlybk.findNearestCuePoint(rtn_obj.time, FLVPlayback.NAVIGATION);
traceit(rtn_obj);
}
my_FLVPlybk.addEventListener("ready", listenerObject);
function traceit(cuePoint:Object):Void {
trace("Cue point name is: " + cuePoint.name);
trace("Cue point time is: " + cuePoint.time);
trace("Cue point type is: " + cuePoint.type);
}
In the following example, the ready event handler finds cue point ASpt and calls the findNextCuePointWithName() method to find the next cue point with the same name:
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv"
var rtn_obj:Object = new Object(); //create cue point object
my_FLVPlybk.addASCuePoint(2.02, "ASpt"); //add AS cue point
my_FLVPlybk.addASCuePoint(3.4, "ASpt"); //add 2nd Aspt
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object):Void {
rtn_obj = my_FLVPlybk.findCuePoint("ASpt");
traceit(rtn_obj);
rtn_obj = my_FLVPlybk.findNextCuePointWithName(rtn_obj);
traceit(rtn_obj);
}
my_FLVPlybk.addEventListener("ready", listenerObject);
function traceit(cuePoint:Object):Void {
trace("Cue point name is: " + cuePoint.name);
trace("Cue point time is: " + cuePoint.time);
trace("Cue point type is: " + cuePoint.type);
}
For more information about finding cue points, see FLVPlayback.findCuePoint(), FLVPlayback.findNearestCuePoint(), and FLVPlayback.findNextCuePointWithName().
|
|
|
|