Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : Load FLV into SWF from URL string


dummy
10/17/2006 10:01:11 PM
I would like to load any flv I have on the server into a an SWF, with a URL
value or FlashVars value. What I don't know how to do is get the actionscript
setup to read the value and put it into something like this:

ns.play(myVideoName);

instead of the normal way:

ns.play("somevideo.flv");

I have the following code so far:

var nc:NetConnection = new NetConnection();
nc.connect(null);

var ns:NetStream = new NetStream(nc);

theVideo.attachedVideo(ns);

ns.play(?);

Thanks to anyone in advance.


derobinson
10/19/2006 5:09:52 PM
Whatever name you give the variable (in the URL string or in FlashVars) is
available at the root level of your movie as soon as it initializes. So if your
URL looks like this:

http://www.myURL.com/index.html?myVideoName=myVid.flv

Then you should be able to access that variable in the manner you
suggest...ns.play(myVideoName)...as soon as the main timeline loads...you may
want to put that code into an onLoad function just to make sure.

Hope that helps!

AddThis Social Bookmark Button