Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > FLVPlayback Component > FLVPlayback class > FLVPlayback.buffering | |||
Flash Player 8.
Flash Professional 8.
varlistenerObject:Object = new Object();listenerObject.buffering = function(eventObject:Object):Void {// insert event-handling code here}; my_FLVplybk.addEventListener("buffering",listenerObject);
Event; dispatched when the FLVPlayback instance enters the buffering state. The FLVPlayback instance typically enters this immediately after a call to the play() method or when the Play control is clicked, before entering the playing state. The event object has the properties state, playheadTime. and vp, which is the index number of the video player to which the event applies. See FLVPlayback.activeVideoPlayerIndex and FLVPlayback.visibleVideoPlayerIndex.
The FLVPlayback instance also dispatches the stateChange event when buffering begins.
The following example creates a listener for the buffering event. When a buffering event occurs, the event handler calls the trace() method to display the values of the state and vp properties.
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.buffering = function(eventObject:Object) {
trace("The state property has a value of " + eventObject.target.state);
trace("The video player number is: " + eventObject.vp);
};
my_FLVPlybk.addEventListener("buffering", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
FLVPlayback.addEventListener(), FLVPlayback.state, FLVPlayback.removeEventListener()
Flash CS3