FLVPlayback.autoSize

Availability

Flash Player 8.

Edition

Flash Professional 8.

Usage

my_FLVPlybk.autoSize

Description

Property; a Boolean value that, if true, causes the video to size automatically to the dimensions of the source FLV file. If this property is set from false to true after an FLV file has been loaded, the automatic resizing starts immediately. The default value is false.

Example

The following example first show the source dimensions of the FLV file (preferredWidth and preferredHeight) when the FLV file is ready to play. Then it calls the setSize() to change the dimensions of the FLVPlayback instance, triggering a resize event. Next, it sets the autoSize property to true, triggering another resize event that restores the size to the dimensions of the source FLV file. The resize event handler displays the dimensions of the FLVPlayback instance in the Output panel after each event.

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 in the Library
*/
import mx.video.*;
my_FLVPlybk.maintainAspectRatio = false;
var listenerObject:Object = new Object();
listenerObject.ready = function(eventObject:Object) {
    trace("FLV width is: " + my_FLVPlybk.preferredWidth + " FLV height is: " + my_FLVPlybk.preferredHeight);
    my_FLVPlybk.setSize(400, 400);
    my_FLVPlybk.autoSize = true;
};
my_FLVPlybk.addEventListener("ready", listenerObject);
listenerObject.resize = function(eventObject:Object) {
    trace("my_FLVPlybk width is: " + my_FLVPlybk.width + "; my_FLVPlybk.height is: " + my_FLVPlybk.height);
};
my_FLVPlybk.addEventListener("resize", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";

See also

FLVPlayback.maintainAspectRatio, FLVPlayback.preferredHeight, FLVPlayback.preferredWidth, FLVPlayback.resize