Flash CS3 Documentation |
|||
| ActionScript 2.0 Components Language Reference > FLVPlayback Component > FLVPlayback class > FLVPlayback.activeVideoPlayerIndex | |||
Flash Player 8.
Flash Professional 8.
my_FLVPlybk.activeVideoPlayerIndex
Property; a number that specifies which video player instance is affected by other APIs. Use this property to manage multiple FLV file streams. The default value is 0.
This property does not make the video player visible; use the visibleVideoPlayerIndex property to do that.
A new video player is created the first time activeVideoPlayerIndex is set to a number. When the new video player is created, its properties are set to the value of the default video player (activeVideoPlayerIndex == 0) except for contentPath, totalTime, and isLive, which are always set to the default values (empty string, 0, and false, respectively), and autoPlay, which is always false (the default is true only for the default video player, 0). The cuePoints property has no effect, as it would have no effect on a subsequent load into the default video player.
APIs that control volume, positioning, dimensions, visibility, and UI controls are always global, and their behavior is not affected by setting activeVideoPlayerIndex. Specifically, setting the activeVideoPlayerIndex property does not affect the following properties and methods.
|
Properties and Methods Not Affected by activeVideoPlayerIndex |
|||
|---|---|---|---|
backButton
|
playPauseButton
|
skin
|
width
|
bufferingBar
|
scaleX
|
stopButton
|
x
|
bufferingBarHidesAndDisablesOthers
|
transform
|
y
|
|
forwardButton
|
scaleY
|
visible
|
setSize()
|
height
|
seekBar
|
volume
|
setScale()
|
muteButton
|
seekBarInterval
|
volumeBar
|
|
pauseButton
|
seekBarScrubTolerance
|
volumeBarInterval
|
|
playButton
|
seekToPrevOffset
|
volumeBarScrubTolerance
|
|
|
NOTE |
|
The |
APIs that control dimensions do interact with the visibleVideoPlayerIndex property, however. For more information, see FLVPlayback.visibleVideoPlayerIndex.
The remaining APIs target a specific video player based on the setting of activeVideoPlayerIndex.
When listening for events, you get all events for all video players. To distinguish which video player the event is for, use the event's vp property, a number corresponding to the number set in activeVideoPlayerIndex and visibleVideoPlayerIndex. All events have this property except for resize and volume, which are not specific to a video player but are global for the FLVPlayback instance.
For example, to load a second FLV file in the background, set activeVideoPlayerIndex to 1 and call the load() method. When you are ready to show this FLV file and hide the first one, set visibleVideoPlayerIndex to 1.
The following example creates two video players to play two FLV files consecutively in a single FLV file instance. It sets the activeVideoPlayerIndex property to switch between the video players and their respective FLV files.
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.*;
// specify name and location of FLV for default player
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/clouds.flv";
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object):Void {
// add a second video player and specify the name and loc of its FLV
my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
// reset to default video player, which plays its FLV automatically
my_FLVPlybk.activeVideoPlayerIndex = 0;
};
my_FLVPlybk.addEventListener("ready", listenerObject);
listenerObject.complete = function(eventObject:Object):Void {
// if complete is for 2nd FLV, make default active and visible
if (eventObject.vp == 1) {
my_FLVPlybk.activeVideoPlayerIndex = 0;
my_FLVPlybk.visibleVideoPlayerIndex = 0;
}
else { // make 2nd player active & visible and play FLV
my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.visibleVideoPlayerIndex = 1;
my_FLVPlybk.play();
}
};
// add listener for complete event
my_FLVPlybk.addEventListener("complete", listenerObject);
FLVPlayback.bringVideoPlayerToFront(), FLVPlayback.getVideoPlayer(), VideoPlayer class, FLVPlayback.visibleVideoPlayerIndex,
Flash CS3