Flashvars 无法加载

发布于 2024-12-25 10:29:40 字数 2450 浏览 4 评论 0原文

我在将 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦境 2025-01-01 10:29:40

一种解决方法是嵌入整个 TLF 运行时,而不是从外部加载它。 adobe 的此操作方法中描述了执行此操作的步骤:

要在已发布的 SWF 文件中编译 TLF ActionScript 资源:

  • 选择文件>发布设置。

  • 单击 Flash 选项卡。

  • 单击“脚本”菜单旁边的“设置”按钮。

  • 单击“库路径”选项卡。

  • 从“默认链接”菜单中选择“合并到代码”。

显然,这会显着增加 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:

To compile the TLF ActionScript assets in published SWF files:

  • Choose File > Publish Settings.

  • Click the Flash Tab.

  • Click the Settings button next to the Script menu.

  • Click the Library Path tab.

  • Select Merged Into Code from the Default Linkage menu.

This, obviously, increases your swf file size significantly.

淡淡绿茶香 2025-01-01 10:29:40

好吧,这是 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

扛刀软妹 2025-01-01 10:29:40

您是否尝试在调试模式下运行它?该声明

this[i] = obj[i];

给出了例外。除非您的类是动态的,否则您无法在 Actionscript 中执行此操作。评论该行并且它起作用了。

Did you try running this in Debug mode. The statement

this[i] = obj[i];

is giving exception. You can't do this in Actionscript unless your class is Dynamic. Commented the line and it worked.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文