I did some code for making a flash audio player .. This player takes the sound source by its FlashVars param. Its working locally fine .. But when it is in server only shows swf file but does dot play sound as expected. Why this happens. My actionscript code is bellow..
var keyStr:String;
var valueStr:String;
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters; //set the paramObj variable to the parameters property of the LoaderInfo object
for (keyStr in paramObj)
{
valueStr = String(paramObj[keyStr]);
var req:URLRequest = new URLRequest(valueStr);
}
sound_icon.visible = true
sound_icon.addEventListener(MouseEvent.CLICK, playSound);
var s:Sound = new Sound(req);
gotoAndStop("f2");//firstly animated sound icon is stopped at the beginning position
function playSound(e:MouseEvent):void{
sound_icon.visible = false; //hide sound icon
gotoAndPlay("f2"); //play animated sound icon from beginning
var mySoundChannel:SoundChannel = s.play(); //reference for getting complete event
mySoundChannel.addEventListener(Event.SOUND_COMPLETE, songFinished);
function songFinished(ev:Event):void
{
sound_icon.visible = true;
gotoAndStop("f2");
}
}
and php code is below
<div id="flashContent">
<?php
$swfSourcePath = "soundtest.swf";
$soundSourcePath = "4.mp3";
?>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="40" height="40" id="soundtest" align="middle">
<param name="movie" value="<?php echo $swfSourcePath;?>" />
<param name=FlashVars value="myVariable=<?php echo $soundSourcePath;?>" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="soundtest.swf" width="40" height="40">
<param name="movie" value="<?php echo $swfSourcePath;?>" />
<param name=FlashVars value="myVariable=<?php echo $soundSourcePath;?>" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
There are some options: