6 Replies Latest reply on May 25, 2010 8:45 AM by rsquaredpgh

    Need help with FlashVars and PHP

    rsquaredpgh

      I'm trying to pass a variable (an mp3 URL) generated from a SQL query with PHP to a small flash mp3 player embedded in the page. I am using FlashVars and its not receiving the .swf is not receiving the variable.

       

      Here is the embed code:

       

      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="35" height="35">
      <param name="movie" value="http://www.myurl.com/audioButton.swf"  />
      <param name="quality" value="high" />
      <param name="FlashVars" value="theFile=<?php echo $myaudio; ?>" />
      <embed src="example.swf" width="550" height="400" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="theFile=<?php echo $myaudio; ?>"></embed>
      </object>

       

      I've declared the variable at the top of the page like so:

       

      $myaudio = "http://www.myurl.com/demo.mp3";

       

      When I load the page, the flash player doesn't play the mp3. But if I put the mp3 URL directly into the embed code (see below) it works ...

       

      <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,79,0" width="35" height="35">
      <param name="movie" value="http://www.r2creative.com/audioButton.swf"  />
      <param name="quality" value="high" />
      <param name="FlashVars" value="theFile=http://www.myurl.com/demo.mp3" />
      <embed src="example.swf" width="550" height="400" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="theFile=http://www.myurl.com/demo.mp3"></embed>
      </object>