ActionScript 2.0 Components Language Reference |
|
|
|
| FLVPlayback Component > FLVPlayback class > FLVPlayback.preferredWidth | |||
Flash Player 8.
Flash Professional 8.
my_FLVPlybk.preferredWidth
Property; gives the width of the source FLV file. This information is not valid immediately when the play() or load() methods are called; it is valid when the ready event starts. If the value of the autoSize or maintainAspectRatio properties is true, it is best to read the value when the resize event starts. Read-only.
The following example sets the size of the FLVPlayback instance when the ready event occurs. When the cuePoint event occurs, it resets the size to the size specified by preferredHeight and preferredWidth properties.
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.*;
var listenerObject:Object = new Object();
listenerObject.resize = function(eventObject:Object):Void {
trace("width is: " + my_FLVPlybk.width);
trace("height is: " + my_FLVPlybk.height);
};
my_FLVPlybk.addEventListener("resize", listenerObject);
listenerObject.ready = function(eventObject:Object):Void {
my_FLVPlybk.setSize(250, 350);
};
my_FLVPlybk.addEventListener("ready", listenerObject);
listenerObject.cuePoint = function(eventObject:Object):Void {
my_FLVPlybk.setSize(my_FLVPlybk.preferredWidth, my_FLVPlybk.preferredHeight);
};
my_FLVPlybk.addEventListener("cuePoint", listenerObject);
my_FLVPlybk.contentPath = "http://www.helpexamples.com/flash/video/water.flv";
my_FLVPlybk.addASCuePoint(1.5, "AScp1");
FLVPlayback.autoSize, FLVPlayback.height, FLVPlayback.maintainAspectRatio, FLVPlayback.preferredHeight, FLVPlayback.ready, FLVPlayback.setSize(), FLVPlayback.setScale(), FLVPlayback.width
|
|
|
|