ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.findNearestCuePoint() | |||
Flash Player 8.
Flash Professional 8.
my_FLVplybk.findNearestCuePoint(time:Number[,type:String]):Objectmy_FLVplybk.findNearestCuePoint(name:String[,type:String]):Objectmy_FLVplybk.findNearestCuePoint(cuePoint:Object[,type:String]):Object
time A number that is the time, in seconds, of the cue point for which to search. The method uses only the first three decimal places and rounds any additional decimal places that you provide. The method returns the cue point that matches this time or the nearest earlier cue point of the specified type. If multiple cue points have the same time, which can only occur with ActionScript cue points, the method returns only the name that is first in alphabetical order. It returns null if it does not find a match.
name A string that is the name of the cue point for which to search. The method returns the first cue point that matches this name or null, if it does not find a match.
cuePoint An object that is a cue point object containing time and name properties for which to search. If you provide a time and the name property has no value or is null, the search behaves as if the parameter is a number representing the time for which to search. If you provide a name and the time property has no value, is null, or is less than zero, the search behaves as if the parameter is a string containing a name for which to search. If you provide both the time and name properties and a cue point exists that matches those values, the method returns it. If it does not find a match for both the time and name, it returns the first cue point that matches the name and has an earlier time. If there is no earlier cue point with that name, it returns the first cue point that matches that name. Otherwise, the method returns null.
type Optional. A string that specifies the type of cuepoint for which to search. The possible values for this parameter are: "actionscript", "all", "event", "flv", or "navigation". You can specify these values using the following class properties: FLVPlayback.ACTIONSCRIPT, FLVPlayback.ALL, FLVPlayback.EVENT, FLVPlayback.FLV, and FLVPlayback.NAVIGATION.If this parameter is not specified, the default is "all", which means the method will search all cue point types.
An object that is a copy of the found cue point object with the following additional properties:
array The array of cue points searched. Treat this array as read-only as adding, removing or editing objects within it can cause cue points to malfunction.
index The index into the array for the returned cue point.
Returns null if no match was found.
Method; finds a cue point of the specified type that matches or is earlier than the time that you specify, or that matches the name that you specify, if you specify both a time and a name and no earlier cue point matches that name. Otherwise, it returns null.
The method includes disabled cue points in the search. Use the isFLVCuePointEnabled() method to determine if a cue point is disabled.
If the time is null, undefined, or less than 0 and the name is null or undefined, the method throws a VideoError error (1002).
The following example creates an ActionScript cue point for the FLV file at 4.07 seconds. When this cue point occurs, the cuePoint event handler calls the findNearestCuePoint() method to find a cue point of any type that is nearest to 5 seconds later. The Output panel shows the name, time, and type of the cue point that is returned.
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 cuePt:Object = new Object(); //create cue point object
cuePt.time = 4.07;
cuePt.name = "ASpt1";
cuePt.type = "actionscript";
my_FLVPlybk.addASCuePoint(cuePt); //add AS cue point
function cuePoint(eventObject:Object):Void {
if (eventObject.info.name == "ASpt1") {
var rtn_obj:Object = new Object();
rtn_obj = my_FLVPlybk.findNearestCuePoint(eventObject.info.time + 5);
trace("Cue point name is: " + rtn_obj.name);
trace("Cue point time is: " + rtn_obj.time);
trace("Cue point type is: " + rtn_obj.type);
}
}
my_FLVPlybk.addEventListener("cuePoint", cuePoint);
FLVPlayback.addASCuePoint(), FLVPlayback.cuePoints, FLVPlayback.findCuePoint(), FLVPlayback.findNextCuePointWithName(), FLVPlayback.isFLVCuePointEnabled(), FLVPlayback.removeASCuePoint(), FLVPlayback.seekToNavCuePoint(), FLVPlayback.seekToNextNavCuePoint(), FLVPlayback.seekToPrevNavCuePoint(), FLVPlayback.setFLVCuePointEnabled()
|
|
|
|