ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.metadataReceived | |||
Flash Player 8.
Flash Professional 8.
varlistenerObject:Object = new Object();listenerObject.metadataReceived = function(eventObject:Object):Void {// insert event-handling code here}; my_FLVplybk.addEventListener("metadataReceived",listenerObject);
Event; dispatched the first time the FLV file metadata is reached. The event object has an info property that contains the info object received by the NetStream.onMetaData callback.
The event also has the vp property, which is the index number of the video player to which the event applies. For more information, see FLVPlayback.activeVideoPlayerIndex and FLVPlayback.visibleVideoPlayerIndex.
The following example creates a listener for the metadataReceived event. When the event occurs, the event handler sends the name, time, and type of each cue point that is described in the metadata property to the Output panel.
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.*;
var listenerObject:Object = new Object();
listenerObject.metadataReceived = function(eventObject:Object):Void {
var i:Number = 0;
trace("This FLV contains the following cue points:");
while(i < my_FLVPlybk.metadata.cuePoints.length) {
trace("\nName: " + my_FLVPlybk.metadata.cuePoints[i].name);
trace(" Time: " + my_FLVPlybk.metadata.cuePoints[i].time);
trace(" Type is " + my_FLVPlybk.metadata.cuePoints[i].type);
++i;
}
};
my_FLVPlybk.addEventListener("metadataReceived", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/cuepoints.flv";
FLVPlayback.metadata, FLVPlayback.metadataLoaded
|
|
|
|