nboulikas
12-06-2010, 02:45 PM
The following example creates a listener for the playheadUpdate event. When it occurs, the event handler checks to see whether the playhead time is between 5 and 5.05 seconds. If it is, the event handler calls the pause() method to suspend playing the FLV file. The paused event handler prompts you to push the Play button to continue.
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
*/
import mx.video.*;
my_ta.visible = false;
my_FLVPlybk.playheadUpdateInterval = 5;
my_FLVPlybk.contentPath = "http/ww.helpexamples.com/flash/video/water.flv";
var listenerObject:Object = new Object();
listenerObject.playheadUpdate = function(eventObject:Object):Void {
if ((eventObject.playheadTime >= 5) && (eventObject.playheadTime < 5.05)) {
my_FLVPlybk.pause();
}
};
my_FLVPlybk.addEventListener("playheadUpdate", listenerObject);
listenerObject.paused = function(eventObject:Object):Void {
my_ta.text = "Paused; push Play to continue";
my_ta.visible = true;
};
my_FLVPlybk.addEventListener("paused", listenerObject);
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
*/
import mx.video.*;
my_ta.visible = false;
my_FLVPlybk.playheadUpdateInterval = 5;
my_FLVPlybk.contentPath = "http/ww.helpexamples.com/flash/video/water.flv";
var listenerObject:Object = new Object();
listenerObject.playheadUpdate = function(eventObject:Object):Void {
if ((eventObject.playheadTime >= 5) && (eventObject.playheadTime < 5.05)) {
my_FLVPlybk.pause();
}
};
my_FLVPlybk.addEventListener("playheadUpdate", listenerObject);
listenerObject.paused = function(eventObject:Object):Void {
my_ta.text = "Paused; push Play to continue";
my_ta.visible = true;
};
my_FLVPlybk.addEventListener("paused", listenerObject);