Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vars Passed Thru Query String for Flash Screen Saver

Status
Not open for further replies.

PullMyWeight

Programmer
Oct 8, 2001
4
US
I'm creating an ms Active Channel Screen Saver. My users can have a screen saver that periodically gets info from my site. but that doesn't really matter- the issue is straight forward: i need to get values from query string ("?news=abc&show=xyz")and plug them into flash embed and param tags. i'm passing values to flash via javascript because the scripting must be client sided. so no asp etc and would rather not do cookies. so..

in my screensaver.htm page i get the substring from the url.
var info = String(location.search.substring())

then plug in my "info " var wherever i need it, ex:
<SCRIPT LANGUAGE=&quot;javascript&quot;>
document.write(&quot;param name=movie value='images/marsh.swf&quot; + info + &quot;'&quot; );
</script>

i put some more document.write(&quot;info&quot;) s on my page to test that i'm getting the values i should and i do - so why then doesn't the flash load properly then?

wondering if the problem was that &quot;info&quot; needs to be defined as a string?? var info = string(location.search.substring())?????

test it yerself:
 
The only thing I can see from what you have above is that there are no &quot;<&quot; around the param, but I'd say you just cut that out.

Otherwise are you sure your flash movie is picking the variables up from the right place?

P.S. that link is crashing me at the moment.
 
i figure a url string is a url string:
also, as far as the link not working - it should work now - i forgot to convert from local host... and is it crashing your computer? because as it stands now for me it seems to try to load the flash movie forever - so don't let it continue to try to load....

thanks.
 
Yep the query string is perfect, and is being tacked on to the movie.

I think you have the swf in the wrong location, I can't get it to load. Is this what you mean by continues to try and load?

Have you tried testing it with PHP or something? This way you can read exactly what's going in by viewing source.

Also, as a test, try it with no document.writes, and just tack on the variable, then see if the movie picks it up, if it does you know there is a proble elsewhere.

BB
 
here is the flash file
i've tested it a bunch of ways and it works when not using js. i've used asp and it works great - problem is - for it to run locally on the person's desktop it has to have local scripts.. since its ie only maybe i'll try using vbscript?...

i've had data type issues before with vb in asp and reading query strings - perhaps this is the issue.. any good resources on js datatype conversions?
 
I have been trying to get this to work and have found that it depends on what I write in. If I write in the opening <OBJECT...> then I have no problems.

If I try to just write in the <PARAM...> I get that loading thing, where it sits there like it can't find it.

Otherwise it works fine.

BB


 
what os/browser r you using - me= win 2000pro w/ ie 5. because i get something different - when i manually put in movie.swf?news=whatever in param tag it works but not when i do it in the embed tag. it depends on the browser i think.

also - i think i've found the root level problem: the ie browser is not reading the flash param or embed instructions when i document.write(&quot;<param etc etc>&quot;) - i tested it without passing any variables. same faultering loading garbage.

and i also found that netscape, however would play the flash movie - but would not pass the variables to flash. doesn't really matter because it's to work solely for ie.
 
I'll just give you what I have - compare them and see what's happening - it seems to work for me [98,IE5.5].

Cut it out and past into editor to see properly.

<script language=&quot;JavaScript&quot;>
//Write in the object and param tag
var vars = document.location.search;
var URL = &quot;query_loader/query_loader.swf&quot; + vars;
document.write(&quot;<OBJECT classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 codebase=' WIDTH=550 HEIGHT=200>&quot;);
document.write(&quot;<PARAM NAME=movie VALUE=&quot;+URL+&quot;>&quot;);
</script>
<PARAM NAME=quality VALUE=high>
<PARAM NAME=bgcolor VALUE=#FFFFFF>
<param name='wmode' value='transparent'>
<script>
// write in the embed tag.
document.write(&quot;<EMBED src=query_loader/query_loader.swf&quot; + URL + &quot; quality=high bgcolor=#FFFFFF WIDTH=550 HEIGHT=200 TYPE=\&quot;application/x-shockwave-flash\&quot; PLUGINSPAGE=\&quot; </script>
</OBJECT>

I realise this is not to strict &quot;XML&quot; standard, but it illustrates that we don't have to write everything, but it is important for some reason to write in the opening <object> with the parameter.

Any joy?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top