FlashVars在本地运行但不在实时服务器上运行

时间:2017-03-31 11:17:16

标签: flash server actionscript 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>

1 个答案:

答案 0 :(得分:1)

有一些选择:

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