ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.addASCuePoint() | |||
Flash Player 8.
Flash Professional 8.
my_FLVplybk.addASCuePoint(cuePoint:Object)my_FLVplybk.addASCuePoint(time:Number,name:String[,parameters:Object])
cuePoint An object having name:String and time:Number (in seconds) properties, which describe the cue point. It also might have a parameters:Object property that holds name/value pairs. It may have type:String set to "actionscript". If type is missing or set to something else, it is set automatically. If the object does not conform to these conventions, the method throws a VideoError error.
time A number that is the time for the new cue point to be added. If you use the time parameter, the name parameter must follow.
name A string that specifies the name of the cue point if you submit a time parameter instead of the CuePoint object.
parameters Optional parameters for the cue point.
A copy of the cue point object that was added 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.Method; adds an ActionScript cue point and has the same effect as adding an ActionScript cue point using the Cue Points dialog box, except that it occurs when an application executes rather than during application development.
Cue point information is wiped out when the contentPath property is set. To set cue point information for the next FLV file to be loaded, set the contentPath property first.
It is valid to add multiple ActionScript cue points with the same name and time. When you remove ActionScript cue points with the removeASCuePoint() method, all cue points with the same name and time are removed.
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 while playing, 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 = 2.444;
cuePt.name = "ASCuePt1";
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, "ASCuePt2");
var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object):Void {
my_ta.text = "Elapsed time in seconds: " + my_FLVPlybk.playheadTime;
my_ta.visible = true;
};
my_FLVPlybk.addEventListener("cuePoint", listenerObject);
FLVPlayback.findCuePoint(), FLVPlayback.removeASCuePoint()
|
|
|
|