Friday, March 13, 2009

Playing multiple videos Dynamically


Create a connection object

var connection_nc:NetConnection = new NetConnection();

Create a NetStream object and pass the NetConnection object

var stream_ns:NetStream = new NetStream(connection_nc);
stream_ns.client = new Object();

One connection object can be used for more than one video stream.


myVideo is the name of my video object placed on the stage & video.flv is the video file which needs to be played. Now if you want to play another video you have to create a new NetStream object for each video otherwise it will not work. I spent 4 hours just to figure this out & kept trying different techniques to make my 4 different videos work with the same NetStream object. But unfortunately it is not possible.

So guys the trick is to create different NetStream object for each video & have fun.

Happy Streaming!!!

1 comment:

Anonymous said...

Brilliantly clear, thanks Atul - a real help.