Netstream (loading a .flv file)

By mrsam | Jul 6, 2009

actionscript3

Hey all,

I’m currently trying to load an .flv file to my stage. What i’m looking to do is the following;

1 - I want to load the entire .flv file before start playing it - how can I check for that? Can I just put an onComplete listener on my NetStream? How?
2 - When the .flv file ends, it should just start over. How do I define that?
3 - Lets say I want to jump to a certain point of the -flv file - would I be able to do this?
4 - If I were looking to load the video into a movieclip container (lets call it "container_mc"), where would I do that in my code?

All answers are appreciated :)

My code looks like this (currently loads the video to center of the stage).

ActionScript Code:
var video:Video = new Video(); addChild(video);   var nc:NetConnection = new NetConnection(); nc.connect(null);   var ns:NetStream = new NetStream(nc); ns.client = {onMetaData:ns_onMetaData, onCuePoint:ns_onCuePoint};   video.attachNetStream(ns); ns.play(“http://www.helpexamples.com/flash/video/cuepoints.flv”);   function ns_onMetaData(item:Object):void {  trace(“metaData”);  // Resize video instance.  video.width = item.width;  video.height = item.height;  // Center video instance on Stage.  video.x = (stage.stageWidth - video.width) / 2;  video.y = (stage.stageHeight - video.height) / 2; }   function ns_onCuePoint(item:Object):void {  trace(“cuePoint”);  trace(item.name + \t + item.time); }

actionscript3

Please reply at our Forum

Leave a Comment

If you would like to make a comment, please fill out the form below.

Name (required)

Email (required)

Website

Comments

© 2007 ActionScript 3.0