Properties | Methods |
Object
Player version: | Flash Player 6 — The ability to play Flash Video (FLV) files was added in Flash Player 7. The ability to use the On2 VP6 codec and to use an alpha channel was added in Flash Player 8. |
Camera.get()
. In files published for Flash Player 7 and later, you can also use the Video class to play back Flash Video (FLV) files over HTTP or from the local file system. For more information, see the NetConnection class and NetStream class entries. Flash Player 7 supports Flash video (FLV) encoded with the Sorenson Spark video codec. Flash Player 8 supports Flash video (FLV) encoded with either the Sorenson or the On2 VP6 codec and also supports an alpha channel. The On2 VP6 video codec uses less bandwidth than older technologies, and offers additional deblocking and deringing filters.
If your Flash content dynamically loads Flash video (using either progressive download or Flash Communication Server), you can use On2 VP6 video without having to republish your SWF for Flash Player 8, as long as users view your content through Flash Player 8. By streaming or downloading On2 VP6 video into Flash SWF version 6 or 7, and playing the content using Flash Player 8, you avoid having to recreate your SWF files for use with Flash Player 8.
Codec | Content (SWF) Version (publish version) | Flash Player Version (version required for playback) |
---|---|---|
Sorenson Spark | 6 | 6, 7, 8 |
7 | 7, 8 | |
On2 VP6 | 6 | 8* |
7 | 8 | |
8 | 8 |
* If your Flash content dynamically loads Flash video (FLV), you can use On2 VP6 video without having to republish your SWF for Flash Player 8, as long as users use Flash Player 8 to view your content. Only Flash Player 8 supports both publish and playback of On2 VP6 video.
A Video object can be used like a movie clip. As with other objects you place on the Stage, you can control various properties of Video objects. For example, you can move the Video object around on the Stage by using its _x
and _y
properties, you can change its size using its _height
and _width
properties, and so on.
To display the video stream, first place a Video object on the Stage. Then use Video.attachVideo()
to attach the video stream to the Video object.
my_video
. (Do not name it Video.)NetConnection, NetStream |
Property Summary | |
| _alpha : Number
Indicates the alpha transparency value of the Video object specified. |
| deblocking : Number
Indicates the type of deblocking filter applied to decoded video as part of postprocessing. |
| _height : Number
Indicates the height of the Video object, in pixels. |
| height : Number [read-only]An integer specifying the height of the video stream, in pixels. |
| _name : String
Indicates the instance name of the Video object specified. |
| _parent : MovieClip
Indicates the movie clip or object that contains the current Video object. |
| _rotation : Number
Indicates the rotation of the Video object, in degrees, from its original orientation. |
| smoothing : Boolean
Specifies whether the video should be smoothed (interpolated) when it is scaled. |
| _visible : Boolean
Indicates whether the Video object specified by my_video is visible. |
| _width : Number
Indicates the width of the Video object, in pixels. |
| width : Number [read-only]An integer specifying the width of the video stream, in pixels. |
| _x : Number
Indicates the x coordinate of a Video object relative to the local coordinates of the parent movie clip. |
| _xmouse : Number [read-only]Indicates the x coordinate of the mouse position. |
| _xscale : Number
Indicates the horizontal scale ( percentage ) of the Video object as applied from the registration point of the Video object. |
| _y : Number
Indicates the y coordinate of a Video object relative to the local coordinates of the parent movie clip. |
| _ymouse : Number [read-only]Indicates the y coordinate of the mouse position. |
| _yscale : Number
Indicates the vertical scale ( percentage ) of the Video object as applied from the registration point of the Video object. |
Properties inherited from class Object |
__proto__, __resolve, constructor, prototype |
Method Summary | |
| attachVideo(source:Object) : Void
Specifies a video stream ( source ) to be displayed within the boundaries of the Video object on the Stage. |
| clear() : Void
Clears the image currently displayed in the Video object. |
Methods inherited from class Object |
addProperty, hasOwnProperty, isPropertyEnumerable, isPrototypeOf, registerClass, toString, unwatch, valueOf, watch |
Property Detail |
public _alpha : Number
Player version: | Flash Player 8 |
_alpha
set to 0 are active, even though they are invisible.
See also
Video._visible |
public deblocking : Number
Player version: | Flash Player 6 |
If a mode greater than 2 is selected for video when you are using the Sorenson codec, the Sorenson decoder defaults to mode 2 internally.
Use of a deblocking filter has an effect on overall playback performance, and it is usually not necessary for high-bandwidth video. If your system is not powerful enough, you may experience difficulties playing back video with this filter enabled.
Examplemy_video
video object, and lets the user change the deblocking filter behavior on video1.flv. Add a video object called my_video
and a ComboBox instance called deblocking_cb
to your file, and then add the following ActionScript to your FLA or AS file. var deblocking_cb:mx.controls.ComboBox; var my_video:Video; // my_video is a Video object on the Stage var my_nc:NetConnection = new NetConnection(); my_nc.connect(null); var my_ns:NetStream = new NetStream(my_nc); my_video.attachVideo(my_ns); my_ns.play("video1.flv"); deblocking_cb.addItem({data:0, label:'Auto'}); deblocking_cb.addItem({data:1, label:'No'}); deblocking_cb.addItem({data:2, label:'Yes'}); var cbListener:Object = new Object(); cbListener.change = function(evt:Object) { my_video.deblocking = evt.target.selectedItem.data; }; deblocking_cb.addEventListener("change", cbListener);
Use the ComboBox instance to change the deblocking filter behavior on video1.flv.
public _height : Number
Player version: | Flash Player 8 |
Video._width |
public height : Number
[read-only]
Player version: | Flash Player 6 |
Camera.height
property of the Camera object that is capturing the video stream. For FLV files, this value is the height of the file that was exported as FLV. You may want to use this property, for example, to ensure that the user is seeing the video at the same size at which it was captured, regardless of the actual size of the Video object on the Stage.
Example_height
and _width
properties of the Video Symbol instance equal to the height
and width
of the loaded FLV file. To use this example, first create a new Video symbol with an instance name of "myVideo" and place it in the same context as this script. The height
and width
properties will be zero when the NetStream.Play.Start
status code is triggered. By resizing the video when the status of NetStream.Buffer.Full
is received you make sure that its size is correct before the first frame of video is shown.
var netConn:NetConnection = new NetConnection(); netConn.connect(null); var netStrm:NetStream = new NetStream(netConn); myVideo.attachVideo(netStrm); netStrm.play("Video.flv"); netStrm.onStatus = function(infoObject:Object) { switch (infoObject.code) { case 'NetStream.Play.Start' : case 'NetStream.Buffer.Full' : myVideo._width = myVideo.width; myVideo._height = myVideo.height; break; } }
MovieClip._height, Video.width |
public _name : String
Player version: | Flash Player 8 |
public _parent : MovieClip
Player version: | Flash Player 8 |
_parent
. Use the _parent
property to specify a relative path to movie clips or objects that are above the current object. You can use _parent
to move up multiple levels in the display list as in the following:
this._parent._parent._alpha = 20;
_root, MovieClip._target |
public _rotation : Number
Player version: | Flash Player 8 |
my_video._rotation = 450
is the same as my_video._rotation = 90
.
public smoothing : Boolean
Player version: | Flash Player 6 |
false
(no smoothing).
Example
smoothing_btn
) to toggle the smoothing property that is applied to the video my_video
when it plays in a SWF file. Create a button called smoothing_btn
and add the following ActionScript to your FLA or AS file: this.createTextField("smoothing_txt", this.getNextHighestDepth(), 0, 0, 100, 22); smoothing_txt.autoSize = true; var my_nc:NetConnection = new NetConnection(); my_nc.connect(null); var my_ns:NetStream = new NetStream(my_nc); my_video.attachVideo(my_ns); my_ns.play("video1.flv"); my_ns.onStatus = function(infoObject:Object) { updateSmoothing(); }; smoothing_btn.onRelease = function() { my_video.smoothing = !my_video.smoothing; updateSmoothing(); }; function updateSmoothing():Void { smoothing_txt.text = "smoothing = "+my_video.smoothing; }
The MovieClip.getNextHighestDepth()
method used in this example requires Flash Player 7 or later. If your SWF file includes a version 2 component, use the version 2 components DepthManager class instead of the MovieClip.getNextHighestDepth()
method.
public _visible : Boolean
Player version: | Flash Player 8 |
my_video
is visible.
public _width : Number
Player version: | Flash Player 8 — as a read-only property. |
Video._height |
public width : Number
[read-only]
Player version: | Flash Player 6 |
Camera.width
property of the Camera object that is capturing the video stream. For FLV files, this value is the width of the file that was exported as an FLV file. You may want to use this property, for example, to ensure that the user is seeing the video at the same size at which it was captured, regardless of the actual size of the Video object on the Stage.
ExampleVideo.height
.
public _x : Number
Player version: | Flash Player 8 |
Video._xscale, Video._y, Video._yscale |
public _xmouse : Number
[read-only]
Player version: | Flash Player 8 |
Mouse class, Video._ymouse |
public _xscale : Number
Player version: | Flash Player 8 |
percentage
) of the Video object as applied from the registration point of the Video object. The default registration point is (0,0). Scaling the local coordinate system affects the _x
and _y
property settings, which are defined in whole pixels.
Video._x, Video._y, Video._yscale, Video._width |
public _y : Number
Player version: | Flash Player 8 |
Video._x, Video._xscale, Video._yscale |
public _ymouse : Number
[read-only]
Player version: | Flash Player 8 |
Mouse class, Video._xmouse |
public _yscale : Number
Player version: | Flash Player 8 |
percentage
) of the Video object as applied from the registration point of the Video object. The default registration point is (0,0). Scaling the local coordinate system affects the _x
and _y
property settings, which are defined in whole pixels.
Video._x, Video._xscale, Video._y, Video._height |
Method Detail |
public attachVideo(source:Object) : Void
Player version: | Flash Player 6 — The ability to work with Flash Video (FLV) files was added in Flash Player 7. |
source
) to be displayed within the boundaries of the Video object on the Stage. The video stream is either an FLV file being displayed by means of the NetStream.play()
command, a Camera object, or null
. If source
is null
, video is no longer played within the Video object. You don't have to use this method if the FLV file contains only audio; the audio portion of an FLV files is played automatically when the NetStream.play()
command is issued.
If you want to control the audio associated with an FLV file, you can use MovieClip.attachAudio()
to route the audio to a movie clip; you can then create a Sound object to control some aspects of the audio. For more information, see MovieClip.attachAudio()
.
source:Object — A Camera object that is capturing video data or a NetStream object. To drop the connection to the Video object, pass null for source . |
var my_video:Video; //my_video is a Video object on the Stage
var active_cam:Camera = Camera.get();
my_video.attachVideo(active_cam);
The following example plays a previously recorded file named myVideo.flv that is stored in the same directory as the SWF file.
var my_video:Video; // my_video is a Video object on the Stage
var my_nc:NetConnection = new NetConnection();
my_nc.connect(null);
var my_ns:NetStream = new NetStream(my_nc);
my_video.attachVideo(my_ns);
my_ns.play("video1.flv");
Camera class, Netstream class |
public clear() : Void
Player version: | Flash Player 6 |
my_video
) when the user clicks the pause_btn
instance. var pause_btn:Button; var my_video:Video; // my_video is a Video object on the Stage var my_nc:NetConnection = new NetConnection(); my_nc.connect(null); var my_ns:NetStream = new NetStream(my_nc); my_video.attachVideo(my_ns); my_ns.play("video1.flv"); pause_btn.onRelease = function() { my_ns.pause(); my_video.clear(); };
Video.attachVideo |
Properties | Methods |