FlashVars在本地工作,但不能工作



我做了一些代码来制作一个flash音频播放器。该播放器通过其FlashVars参数获取声源。它在当地工作得很好..但是当它在服务器中时,只显示 swf 文件,但点播放声音是否符合预期。为什么会这样。我的动作脚本代码是低价的。

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");
}

}

PHP代码如下

    <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>

有一些选项:

  • 如果使用 Flash 专业版/Animate 打开文件 - 发布设置 - 本地播放安全性,请将其设置为仅访问网络。
  • 尝试使用"flashvars"而不是FlashVars
  • 尝试将源设置为"soundtest.swf?myVariable=4.mp3">

相关内容

最新更新