View Full Version : Loading a dynamic querystring through the url.


Idiotic Creation
12-27-2006, 03:31 PM
Alright, so I'm making a very basic flash mp3 player, but I want it to be able to play a different song depending on what the user clicks.

So, look at this:

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"
width="273" height="150"><param name=movie value="graphics/player.swf?s=<?php if(isset($player)) echo
$b_song; ?>"><param name=quality value=high><param name="wmode" value="transparent"><embed
src="graphics/player.swf?s=<?php if(isset($player)) echo $b_song; ?>" quality=high wmode='transparent'
pluginspage="http://www.macromedia.com/shockwave/download/index.cgi? P1_Prod_Version=ShockwaveFlash"
type="application/x-shockwave-flash" width="273" height="150"></embed></object>


Ok, so this enables me to load in variables, crude I know, but w/e.

Now this is the action script:

//Get song out of querystring
myURL = this._url;
myQueryString = myURL.lastIndexOf("?");
myParam = myURL.substring(myQueryString, myURL.length - 3);
mySong = "songs/" + myParam;

//Playsong
mySound = new Sound();
mySound.loadSound(mySong);
mySound.start(0, 5);


Ok now, I suck with flash and this isn't working for some reason. When I click a song to play it will say "waiting for opticalmusic.net" so I'm pretty sure its loading the song, but it just isn't playing. Any help would be great.

Thanks!
David