[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1282
  • Last Modified:

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

0
espadana
Asked:
espadana
  • 4
  • 4
  • 2
  • +1
1 Solution
 
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now