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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing a querystring variable to flash player

Status
Not open for further replies.

bobolito

IS-IT--Management
Nov 6, 2003
60
0
0
US
<div id="newxspf">
<script type="text/javascript" src="/FMP3/swfobject.js"></script>
<script type="text/javascript">

<!--
var flashObj = new FlashObject
("/FMP3/XSPF_EV.swf?action=stop&vol=80&playlist=/vacilon/jan2006/jan23-jan28/fri/playlist.xml&folder=/FMP3/&textcolor=&color=&loop=playlist&lma=yes&viewinfo=false&display= 1@. - @0@ - @","newxspf", "265", "225", 7, "#800000", true);
flashObj.write ("newxspf");
// -->
</script>
</div>

The code above is the Javascript I use to display the XSPF Flash Player on my web page. It works fine. The problem is, I have several playlists that I want to load to the player depending on the link the user clicks. So, what I want to do is add variables to the playlist part of the code:

("/FMP3/XSPF_EV.swf?action=stop&vol=80&playlist=/vacilon/jan2006/jan23-jan28/fri/playlist.xml....

So instead of having /vacilon/jan2006/jan23-jan28/fri/playlist.xml

I want to have something like /vacilon/&month&/&week&/&day&/playlist.xml

...where month, week and day are variables.

I tried using FlashVars but if I take the "playlist" parameter outside that parenthesis, the player won't load. For instance, if I add this line below the var flashObj line:

flashObj.addParam("playlist", "/vacilon/jan2006/jan23-jan28/fri/playlist.xml")

I also tried addVariable in the same way and the player doesn't load:

flashObj.addVariable("playlist", getQueryParamValue("playlist"))

The only way the player loads is when the playlist parameter is included in the same line with the rest of the other parameters action, vol, folder, etc. I want to know if it is possible to take the playlist out of there or if not, I would like to know if there is a way to add a variable into the line itself. So far, my attempts to add a variable only result in the player not loading. The player loads and plays fine once I make the code look like posted above.

Thanks
 
Thanks. I just figured it out. The problem was I was using the & as the concatenation sign, but in Javascript I'm supposed to use the + sign instead. It works good now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top