FLVPlayback.bringVideoPlayerToFront()

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

my_FLVPlybk.bringVideoPlayerToFront(index:Number)

Parameters

index A number that is the index of the video player to move to the front

Description

Method; brings a video player to the front of the stack of video players. Useful for custom transitions between video players. The stack order is the same as it is for the activeVideoPlayerIndex property: 0 is on the bottom, 1 is above it, 2 is above 1, and so on.

Example

The following example uses two video players to play two FLV files. When each of the three cue points in the first FLV file (cuepoints.flv) occurs, the example calls the bringVideoPlayerToFront() method to bring the other FLV file to the front. Because the example sets the _alpha property to 75 for video player number 1, the FLV file (plane_cuepoints) playing in that player is transparent, making both FLV files visible simultaneously when that FLV file is in front.

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
*/
my_FLVPlybk.load("http://www.helpexamples.com/flash/video/cuepoints.flv");
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object) {
    if (eventObject.target.contentPath == "http://www.helpexamples.com/flash/video/cuepoints.flv") {
        //this fires after the first flv is ready
        my_FLVPlybk.activeVideoPlayerIndex = 1;
        my_FLVPlybk.load("http://www.helpexamples.com/flash/video/plane_cuepoints.flv");
    } else {
        //this fires after the second flv is ready
        eventObject.target.activeVideoPlayerIndex = 0;
        eventObject.target.play();
        eventObject.target.activeVideoPlayerIndex = 1;
        eventObject.target.play();
        var layerOnTop:MovieClip = eventObject.target.getVideoPlayer(1);
        layerOnTop._alpha = 75;
        layerOnTop._visible = true;
    }
}
my_FLVPlybk.addEventListener("ready", listenerObject);

var listenerObject:Object = new Object();
listenerObject.cuePoint = function(eventObject:Object) {
    
    //based upon the cue name, bring one or the other to the front
    if (eventObject.info.name == "point1") {
        trace(eventObject.info.name + " : 0 to front");
        eventObject.target.bringVideoPlayerToFront(1);
    } else if (eventObject.info.name == "point2") {
        trace(eventObject.info.name + " : 1 to front");
        eventObject.target.bringVideoPlayerToFront(0);
    }else if (eventObject.info.name == "point3") {
        trace(eventObject.info.name + " : 0 to front");
        eventObject.target.bringVideoPlayerToFront(1);
    }
}
my_FLVPlybk.addEventListener("cuePoint", listenerObject);

See also

FLVPlayback.activeVideoPlayerIndex, FLVPlayback.getVideoPlayer(), VideoPlayer class, FLVPlayback.visibleVideoPlayerIndex


Flash CS3