Flash CS3 Documentation |
|||
| Programming ActionScript 3.0 > Working with video > Loading video files | |||
Loading videos using the NetStream and NetConnection classes is a multistep process:
null to the connect() method, if you are connecting to a local FLV file that is not using a server such as Adobe's Flash Media Server 2 or Adobe Flex.var nc:NetConnection = new NetConnection(); nc.connect(null);
var ns:NetStream = new NetStream(nc);
ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
ns.play("video.flv");
function asyncErrorHandler(event:AsyncErrorEvent):void
{
// ignore error
}
attachNetStream() method. Then you can add the video object to the display list using the addChild() method, as seen in the following snippet:var vid:Video = new Video(); vid.attachNetStream(ns); addChild(vid);
After entering the previous code, Flash Player will attempt to load the video.flv video file in the same directory as your SWF file.
|
TIP |
|
To load FLV files from a web server, you might need to register the file extension and MIME type with your web server; check your web server documentation. The MIME type for FLV files is |
Flash CS3
Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flash/9.0/main/00000255.html