Flashvars 无法加载
我在将 Flashvars 加载到 Flash 应用程序时遇到了一个奇怪的问题。我尝试隔离代码并在其他文档中尝试,但返回的对象仍然是空的。
这是我的 HTML 代码:
<div id="Div1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="630" height="671" id="testApp" align="middle">
<param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="FlashVars" value="one=1&two=2" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="{$this->siteUrl}/flash/testVars.swf" width="630" height="671">
<param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="FlashVars" value="one=1&two=2" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--<![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>
这是我的 as3 代码:
ExternalInterface.call('console.log', "Begin")
var obj:Object = this.loaderInfo.parameters;
for(var i:String in obj)
{
this[i] = obj[i];
ExternalInterface.call('console.log', "Parsing: " + i + " - " + obj[i])
}
它在 Chrome 的控制台窗口中很好地显示了开始,但它不打印 flashvars。你能告诉我我做错了什么吗?
谢谢!
I've got a weird problem with loading Flashvars into my flash application. I tried to isolate the code and try it in an other document, but the object returned is still empty.
This is my HTML code:
<div id="Div1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="630" height="671" id="testApp" align="middle">
<param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="FlashVars" value="one=1&two=2" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="{$this->siteUrl}/flash/testVars.swf" width="630" height="671">
<param name="movie" value="{$this->siteUrl}/flash/testVars.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="FlashVars" value="one=1&two=2" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="always" />
<!--<![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>
This is my as3 code:
ExternalInterface.call('console.log', "Begin")
var obj:Object = this.loaderInfo.parameters;
for(var i:String in obj)
{
this[i] = obj[i];
ExternalInterface.call('console.log', "Parsing: " + i + " - " + obj[i])
}
It show begin nicely in the console window of Chrome, but it does not print the flashvars. Can you tell me what I'm doing wrong?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
一种解决方法是嵌入整个 TLF 运行时,而不是从外部加载它。 adobe 的此操作方法中描述了执行此操作的步骤:
显然,这会显着增加 swf 文件的大小。
One work around is to embed the whole TLF runtime instead of loading it externally. The steps for doing so are described in this how-to by adobe:
This, obviously, increases your swf file size significantly.
好吧,这是 Flash 中 TLF 文本组件的一个“错误”。
在文档中包含 TLF 文本元素还包含文本布局框架运行时共享库 (TLF RSL)。 RSL 在您的主影片之前添加一个预加载器,
这意味着您的 swf 不再是第一个加载的影片,因此它会导致 FlashVars 无法访问。
Adrian Parr 有一篇关于此的优秀博客文章:
http://www.adrianparr.com/?p=137
Ok, so this is a 'bug' in Flash with the TLF Text component.
Including a TLF Text element within your document also includes the Text Layout Framework Runtime Shared Library (TLF RSL). The RSL prepends a preloader before your main movie
This means that your swf is no longer the first movie loaded and so it renders the FlashVars unaccesable.
Adrian Parr has an exelent blog item about this:
http://www.adrianparr.com/?p=137
您是否尝试在调试模式下运行它?该声明
给出了例外。除非您的类是动态的,否则您无法在 Actionscript 中执行此操作。评论该行并且它起作用了。
Did you try running this in Debug mode. The statement
is giving exception. You can't do this in Actionscript unless your class is Dynamic. Commented the line and it worked.