MACROMEDIA FLASH 8-COMPONENTS LANGUAGE Reference page 524

Components language reference
Table of Contents

Advertisement

The following ActionScript code loads the
default video player and adds a cue point for it. When the
handler opens a second video player by setting the
number 1. It specifies an FLV file and a cue point for the second video player and then makes
the default player (0) the active video player again.
/**
Requires:
- FLVPlayback component on the Stage with an instance name of my_FLVPlybk
*/
// add a cue point to the default player
import mx.video.*;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/
clouds.flv";
my_FLVPlybk.addASCuePoint(3, "1st_switch");
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object):Void {
// add a second video player and create a cue point for it
my_FLVPlybk.activeVideoPlayerIndex = 1;
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/
water.flv";
my_FLVPlybk.addASCuePoint(3, "2nd_switch");
my_FLVPlybk.activeVideoPlayerIndex = 0;
};
my_FLVPlybk.addEventListener("ready", listenerObject);
To switch to another FLV file while one is playing, you must obtain control to make the
switch in your ActionScript code. Cue points allow you to intervene at specific points in the
FLV file using a
cuePoint
and calls a handler function that pauses the active video player (0), switches to the second
player (1), and plays its FLV file:
// create a listener object
var listenerObject:Object = new Object();
// add a handler function for the cuePoint event
listenerObject.cuePoint = function(eventObject:Object):Void {
// display the no. of the video player causing the event
trace("Hit cuePoint event for player: " + eventObject.vp);
// test for the video player and switch FLVs accordingly
if (eventObject.vp == 0) {
my_FLVPlybk.pause(); //pause the first FLV
my_FLVPlybk.activeVideoPlayerIndex = 1; // make the 2nd player active
my_FLVPlybk.visibleVideoPlayerIndex = 1; // make the 2nd player
visible
my_FLVPlybk.play(); // begin playing the new player/FLV
} else if (eventObject.vp == 1) {
my_FLVPlybk.pause(); // pause the 2nd FLV
my_FLVPlybk.activeVideoPlayerIndex = 0; // make the 1st player active
522
FLVPlayback Component (Flash Professional Only)
contentPath
event. The following code creates a listener for the
property to play an FLV file in the
event occurs, the event
ready
activeVideoPlayerIndex
property to the
event
cuePoint

Hide quick links:

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the FLASH 8-COMPONENTS LANGUAGE and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Flash 8

Table of Contents