ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.findCuePoint() | |||
Flash Player 8.
Flash Professional 8.
my_FLVplybk.findCuePoint(time:Number[,type:String]):Object my_FLVplybk.findCuePoint(name:String[,type:String]):Object my_FLVplybk.findCuePoint(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. If multiple ActionScript cue points have the same time, 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 it returns 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 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 the time property has no value, is null, or is less than zero, then 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. Otherwise, the method returns null.
type Optional. A string that specifies the type of cue point 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 that were searched. Treat this array as read-only because 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 is found.
Method; finds the cue point of the type specified by the type parameter and having the time, name, or combination of time and name that you specify through the parameters.
If you do not provide a value for either the time or name of the cue point, or if the time is null, undefined, or less than zero and the name is null or undefined, the method throws VideoError error 1002. For more information, see VideoError class.
The method includes disabled cue points in the search. Use the isFLVCuePointEnabled() method to determine if a cue point is disabled.
The following example adds two ActionScript cue points to an FLV file, and then calls the findCuePoint() method three times. The first call looks for a navigation cue point with a time of 7.748. The second call looks for cue point "ASCue1", using only a name value. The third call uses a cue point object that specifies both a time, 10, and a name, "ASCue2". After the third call, the example shows the content of the returned cue point object, including the array of cue points that were searched, which, in this example, were ActionScript cue points.
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
*/
// create cue point object
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv";
var cuePt:Object = new Object();
var rtn_cuePt:Object = new Object(); // create object for return value
cuePt.time = 4.444;
cuePt.name = "AScue1";
my_FLVPlybk.addASCuePoint(cuePt); //add AS cue point
// add 2nd AS cue point using time and name parameters
my_FLVPlybk.addASCuePoint(10, "AScue2");
// find navigation cue point using time
rtn_cuePt = my_FLVPlybk.findCuePoint(7.748, FLVPlayback.NAVIGATION);
//find actionscript cue point using name only
rtn_cuePt = my_FLVPlybk.findCuePoint("AScue1");
//find actionscript cue point using cue point object
cuePt.time = 10;
cuePt.name = "AScue2";
rtn_cuePt = my_FLVPlybk.findCuePoint(cuePt, FLVPlayback.ACTIONSCRIPT);
// see what returned cue point object contains
for (i in rtn_cuePt) {
//if an array object, open it up and trace contents
if (typeof rtn_cuePt[i] == "object") {
tracer(rtn_cuePt[i]);
// else trace name (i) and value (rtn_cuePt[i]) pair
} else {
trace(i+ " " + rtn_cuePt[i]);
}
}
// trace array of cue points
function tracer(cuepts:Array) {
for (i in cuepts) {
if (typeof cuepts[i] == "object") { //if object in object
tracer(cuepts[i]); //trace object
} else {
// trace the name : value pair
trace(i + " " + cuepts[i]);
}
}
}
FLVPlayback.addASCuePoint(), FLVPlayback.cuePoints, FLVPlayback.findNearestCuePoint(), FLVPlayback.findNextCuePointWithName(), FLVPlayback.isFLVCuePointEnabled(), FLVPlayback.removeASCuePoint(), FLVPlayback.seekToNavCuePoint(), FLVPlayback.seekToNextNavCuePoint(), FLVPlayback.seekToPrevNavCuePoint(), FLVPlayback.setFLVCuePointEnabled()
|
|
|
|