【问题标题】:Pulling a URI XML location through Flash Vars in CS3通过 CS3 中的 Flash Vars 提取 URI XML 位置
【发布时间】:2011-09-12 15:25:41
【问题描述】:

我目前正在做一个必须是多语言的项目。我需要能够使用 Flash Var 来定位 XML 文件。

任何想法为什么下面的代码不起作用?

这是我的 AS3 代码:

var xmlPath:String;
xmlPath = root.loaderInfo.parameters(encodeURIComponent["xmlPath"]);

这是我的 HTML 代码:

<object id="FlashID" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="195" height="160">
<param name="movie" value="../../../desktop.swf" />
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="FlashVars" value="xmlPath=привет/mp3.xml" />
<!-- This param tag prompts users with Flash Player 6.0 r65 and higher to download the latest version of Flash Player. Delete it if you don't want users to see the prompt. -->
<param name="expressinstall" value="../../../expressInstall.swf" />
<!-- Next object tag is for non-IE browsers. So hide it from IE using IECC. -->
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="../../../desktop.swf" width="195" height="160">
<!--<![endif]-->
<param name="quality" value="high" />
<param name="wmode" value="opaque" />
<param name="swfversion" value="6.0.65.0" />
<param name="FlashVars" value="xmlPath=привет/mp3.xml" />
<param name="expressinstall" value="../../../expressInstall.swf" />
<!-- The browser displays the following alternative content for users with Flash Player 6.0 and older. -->
<div>
  <h4>Content on this page requires a newer version of Adobe Flash Player.</h4>
  <p><a href="http://www.adobe.com/go/getflashplayer"><img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" width="112" height="33" /></a></p>
</div>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>

【问题讨论】:

    标签: html flash actionscript-3


    【解决方案1】:

    由于斜线,您需要转义 flash 变量。

    [编辑]

    //Javascript
    <param name="FlashVars" value="xmlPath=привет&#47;mp3.xml" />
    
    // AS3
    var xmlPath:String;
    xmlPath = unescape( root.loaderInfo.parameters(encodeURIComponent["xmlPath"]) );
    

    如果这不起作用,请验证 mp3.xml 是否存在于浏览器中。

     http://yourserver.com/привет/mp3.xml
    

    【讨论】:

    • var xmlPath:String; xmlPath = root.loaderInfo.parameters(escape["xmlPath"]);这仍然不起作用。
    • 你在 javascript 端转义它并在 AS3 端取消它。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-05
    • 2010-10-20
    • 1970-01-01
    • 2020-03-05
    相关资源
    最近更新 更多