ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.maintainAspectRatio | |||
Flash Player 8.
Flash Professional 8.
my_FLVPlybk.maintainAspectRatio
Property; a Boolean value that, if true, maintains the video aspect ratio. If this property is changed from false to true and the autoSize property is false after an FLV file has been loaded, an automatic resize of the video starts immediately. The default value is true.
The following example calls the setSize() method to change the size of the FLVPlayback instance, causing a resize event. The maintainAspectRatio property, which defaults to true, forces a second resize event to maintain the aspect ratio. The resize event handler displays the width and height of the resized FLVPlayback instance for both occurrences in the Output panel. If you set maintainAspectRatio to false, the dimensions specified by the setSize() method take effect.
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.*;
// maintainAspectRatio defaults to true, causing resize when size changes.
// Remove the comment delimiters from the following line to disable resize.
// my_FLVPlybk.maintainAspectRatio = false;
var listenerObject:Object = new Object();
listenerObject.resize = function(eventObject:Object) {
trace("resize event; Width is: " + eventObject.target.width + " Height is: " + eventObject.target.height);
};
my_FLVPlybk.addEventListener("resize", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
my_FLVPlybk.setSize(300, 300);
FLVPlayback.autoSize, FLVPlayback.height, FLVPlayback.preferredHeight, FLVPlayback.preferredWidth, FLVPlayback.resize, FLVPlayback.setSize(), FLVPlayback.width
|
|
|
|