Flash CS3 Documentation |
|||
| Learning ActionScript 2.0 in Adobe Flash > Working with Images, Sound, and Video > About using FLV video > Playing back external FLV files dynamically | |||
You can load FLV files at runtime to play in a SWF file. You can load them into a video object or into a component such as the FLVPlayback component. The following example shows how to play back a file named clouds.flv in a video object.
this.createTextField("status_txt", 999, 0, 0, 100, 100);
status_txt.autoSize = "left";
status_txt.multiline = true;
// Create a NetConnection object
var my_nc:NetConnection = new NetConnection();
// Create a local streaming connection
my_nc.connect(null);
// Create a NetStream object and define an onStatus() function
var my_ns:NetStream = new NetStream(my_nc);
my_ns.onStatus = function(infoObject:Object):Void {
status_txt.text += "status (" + this.time + " seconds)\n";
status_txt.text += "\t Level: " + infoObject.level + "\n";
status_txt.text += "\t Code: " + infoObject.code + "\n\n";
};
// Attach the NetStream video feed to the Video object
my_video.attachVideo(my_ns);
// Set the buffer time
my_ns.setBufferTime(5);
// Begin playing the FLV file
my_ns.play("http://www.helpexamples.com/flash/video/clouds.flv");
For information on preloading FLV files, see "Preloading FLV files" on page 507. For information on dynamically loading FLV video into components, see Conponents Language Reference. For information on FLV files and the server, and FLV files and playing FLV files locally on the Macintosh, see Configuring your server for FLV files.
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/00001034.html