passing flv url from html


Im quite new to flash/actionscript. Id be very grateful if you could help me.

Im using the FLVPlayback component and trying to pass the url for the flv through html.   The idea is to make the page dynamic so that the user can decide what movie to play.  SWFObject or FlashVars seems to be the way to go. However i havent been able to get it working.  it seems to be a simple thing to implement, but it just does not work for me.

FYI im using ActionScript 3.

my html and AS3 code are below


HTML Code:
<script type="text/javascript" src="swfobject.js"></script>
	<div id="flashcontent">
	<script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("movie1.swf", "MyFBulletin", "512", "325", "8", "#FFFFFF");
		so.addVariable("movieurl", "");
		// ]]>
ActionScript3  code
var movieurl:String;
movieurl = root.loaderInfo.parameters['movieurl'];

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

You can get the variables by

movieurl = Request.QueryString("movieurl");

if your url is like
Aneesh ChopraCommented:
YOUR CODE seems perfect,

make sure:
1) FLV path is correct
2) FLVPlayback instance property "autoPlay" has been set to 'true';
espadanaAuthor Commented:
Thanks for the reply, the issue is that I get the following error:

1119: Access of possibly undefined property loader through a reference with static type flash.display:DisplayObject.

there is something wrong with this line
movieurl = root.loaderInfo.parameters['movieurl'];

Ive tried subtituting "root" with "this" and "super".  I dont get the error anymore, but nothing plays.  Ive also set "autoPlay" to true.

Would i need to import a specific library?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Aneesh ChopraCommented:
try adding following import line on top:

import flash.display.LoaderInfo;
espadanaAuthor Commented:
Thanks; tried that but still the same issue.

I was just wondering if its possible for you to try this code with the flvplayback component, and if it works for you after testing it, to email me the fla file?  Ive tried everything, and dont know what else to do about it.

Im using flash CS3 with AS3

my email is pars AT

Many thanks
Aneesh ChopraCommented:
here is a working sample version I have done for your review:

I also want to update you on the fact that FLV path must be of the same server where SWF is hosted,
in case you want to load the FLV from different server then you need to implement the crossdomain.xml

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Hellow all,

In your html code you use

so.addVariable("movieurl", "");

This means that in the _root of the .fla a variable is set with the value, like
_root.movieurl = "";

In your actionscript you define a new variable with the same name

var movieurl:String;

Maybe this variable overwrites the one that you have set by using flashVars, so the value is NULL or UNDEFINED.

Try changing your as code to:

var movieurlFlash:String;
movieurlFlash = root.loaderInfo.parameters['movieurl'];

Maybe this works.


Aneesh ChopraCommented:
Hi wal_toor,

same variable name will not be any problem in this case, because in AS3 FlashVars variables does not get set on root,
it comes under "root.loaderInfo.parameters"
Hellow aneeshchopra,

Ahaa, i did'nt know that. Thanks.
espadanaAuthor Commented:
Thanks aneeshchopra! your solution worked!

Im not sure why my original one didnt work, as it looks exactly the same as yours!  Maybe there is some sort of settings in the project thats causing this?

Thanks again!!
espadanaAuthor Commented:
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.