passing flv url from html

Hi,

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

thanks

HTML Code:
-----------------
<head>
<script type="text/javascript" src="swfobject.js"></script>
</head>
 
<body>
	<div id="flashcontent">
	</div>
 
	<script type="text/javascript">
		// <![CDATA[
		var so = new SWFObject("movie1.swf", "MyFBulletin", "512", "325", "8", "#FFFFFF");
		so.addVariable("movieurl", "http://mydeo.vo.llnwd.net/.../.../v700.flv");
		so.write("flashcontent");
		// ]]>
	</script>
</body>
 
 
ActionScript3  code
--------------------------
var movieurl:String;
movieurl = root.loaderInfo.parameters['movieurl'];
clip1.source=movieurl;

Open in new window

espadanaAsked:
Who is Participating?

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

x
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.

quincydudeCommented:
You can get the variables by

movieurl = Request.QueryString("movieurl");

if your url is like


www.hello.com/?movieurl=myaddress.swf
0
Aneesh ChopraCommented:
YOUR CODE seems perfect,

make sure:
1) FLV path is correct
2) FLVPlayback instance property "autoPlay" has been set to 'true';
0
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?
0
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;
0
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 fastmail.net

Many thanks
0
Aneesh ChopraCommented:
here is a working sample version I have done for your review:
http://www.4shared.com/file/71445401/d4890c76/FLVPlayback_Using_FlashVars.html

secondly,
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
0

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
wal_toorCommented:
Hellow all,

In your html code you use

so.addVariable("movieurl", "http://mydeo.vo.llnwd.net/.../.../v700.flv");

This means that in the _root of the .fla a variable is set with the value, like
_root.movieurl = "http://mydeo.vo.llnwd.net/.../.../v700.flv";

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'];
clip1.source=movieurlFlash;

Maybe this works.

greetz,
walter

0
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"
0
wal_toorCommented:
Hellow aneeshchopra,

Ahaa, i did'nt know that. Thanks.
0
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!!
0
espadanaAuthor Commented:
thanks
0
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.