ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.resize | |||
Flash Player 8.
Flash Professional 8.
varlistenerObject:Object = new Object();listenerObject.resize = function(eventObject:Object):Void {// insert event-handling code here}; my_FLVplybk.addEventListener("resize",listenerObject);
Event; dispatched when video is resized. This occurs when you set the visibleVideoPlayerIndex property and switch to a video player with different dimensions. The event object has the properties auto, x, y, width, height and vp, which is the index number of the video player to which the event applies. For more information on the vp property, see FLVPlayback.activeVideoPlayerIndex and FLVPlayback.visibleVideoPlayerIndex.
The auto property is true when the resizing is automatic because the autoSize or maintainAspectRatio property is true. In this case, the event might be dispatched for a video player other than the visible video player. The event might be dispatched even if the dimensions do not actually change after an attempt to automatically resize the component occurs.
When the auto property is false, the event always applies to the visible video player. The vp property still appears but will always be equal to the visibleVideoPlayerIndex property.
The component dispatches the event (with auto set to false) when you set the visibleVideoPlayerIndex property if you are switching to a video player with different dimensions than the currently visible player.
The following example plays two FLV files. It adds an ActionScript cue point to the first FLV file and, when the cuePoint event occurs, it switches to a second, smaller video player to play the second FLV file. When it sets the visibleVideoPlayerIndex property for the video player, it triggers the resize event, which displays the size and location of the current video player.
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.*;
// turn off autoSize and maintainAspectRatio
my_FLVPlybk.autoSize = false;
my_FLVPlybk.maintainAspectRatio = false;
// play this FLV
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/clouds.flv";
// add a cue point
my_FLVPlybk.addASCuePoint(3, "switch_here");
var listenerObject:Object = new Object(); // create listener
listenerObject.cuePoint = function(eventObject:Object):Void {
// add a second video player
my_FLVPlybk.activeVideoPlayerIndex = 1;
// play this FLV
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
// change size of this video player
my_FLVPlybk.setSize(240, 180);
my_FLVPlybk.visibleVideoPlayerIndex = 1; // make it visible
my_FLVPlybk.play(); // play VLV
};
// add listener for cuePoint event
my_FLVPlybk.addEventListener("cuePoint", listenerObject);
listenerObject.resize = function(eventObject:Object):Void {
// display location and dimensions
trace("Video player is #" + my_FLVPlybk.activeVideoPlayerIndex);
trace("X coordinate is: " + eventObject.x);
trace("Y coordinate is: " + eventObject.y);
trace("Width is: " + eventObject.width);
trace("Height is: " + eventObject.height);
};
// add listener for resize event
my_FLVPlybk.addEventListener("resize", listenerObject);
FLVPlayback.activeVideoPlayerIndex, FLVPlayback.autoSize, FLVPlayback.height, FLVPlayback.maintainAspectRatio, FLVPlayback.preferredHeight, FLVPlayback.preferredWidth, FLVPlayback.setSize(), FLVPlayback.state, FLVPlayback.width, FLVPlayback.x, FLVPlayback.y
|
|
|
|