我的 flashvars 代码有什么问题?

发布于 2024-09-25 13:36:04 字数 3540 浏览 3 评论 0原文

我正在尝试通过修改 Flash CS5 发布的标准 HTML 将 flashvars 读入我的 flash 文件。以下内容无效:

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 
    <head> 
        <title>flashVarsTests</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <style type="text/css" media="screen"> 
        html, body { height:100%; background-color: #ffffff;}
        body { margin:0; padding:0; overflow:hidden; }
        #flashContent { width:100%; height:100%; }
        </style> 
    </head> 
    <body> 
        <div id="flashContent"> 
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="flashVarsTests" align="middle"> 
                <param name="movie" value="flashVarsTests.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="devicefont" value="false" /> 
                <param name="salign" value="" /> 
                <param name="allowScriptAccess" value="sameDomain" /> 
                <param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" /> 
                <!--[if !IE]>--> 
                <object type="application/x-shockwave-flash" data="flashVarsTests.swf" width="550" height="400"> 
                    <param name="movie" value="flashVarsTests.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="devicefont" value="false" /> 
                    <param name="salign" value="" /> 
                    <param name="allowScriptAccess" value="sameDomain" /> 
                    <param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" /> 
                <!--<![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> 
    </body> 
</html> 

ActionScript:

this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);

function loaderComplete(myEvent:Event)
{
  var flashVars=this.loaderInfo.parameters;
  var msg1:String=flashVars.message1;
  var msg2:String=flashVars.message2;
  text1.text=msg1;
  text2.text=msg2;
}

谢谢-

I'm trying to read flashvars into my flash file by modifying the standard HTML published out of Flash CS5. The following isn't working:

HTML:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> 
    <head> 
        <title>flashVarsTests</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
        <style type="text/css" media="screen"> 
        html, body { height:100%; background-color: #ffffff;}
        body { margin:0; padding:0; overflow:hidden; }
        #flashContent { width:100%; height:100%; }
        </style> 
    </head> 
    <body> 
        <div id="flashContent"> 
            <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550" height="400" id="flashVarsTests" align="middle"> 
                <param name="movie" value="flashVarsTests.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="devicefont" value="false" /> 
                <param name="salign" value="" /> 
                <param name="allowScriptAccess" value="sameDomain" /> 
                <param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" /> 
                <!--[if !IE]>--> 
                <object type="application/x-shockwave-flash" data="flashVarsTests.swf" width="550" height="400"> 
                    <param name="movie" value="flashVarsTests.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="devicefont" value="false" /> 
                    <param name="salign" value="" /> 
                    <param name="allowScriptAccess" value="sameDomain" /> 
                    <param name="flashvars" value="message1=HelloWorld&message2=HeyGuy" /> 
                <!--<![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> 
    </body> 
</html> 

ActionScript:

this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);

function loaderComplete(myEvent:Event)
{
  var flashVars=this.loaderInfo.parameters;
  var msg1:String=flashVars.message1;
  var msg2:String=flashVars.message2;
  text1.text=msg1;
  text2.text=msg2;
}

Thanks-

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

生活了然无味 2024-10-02 13:36:04

TLF TEXT 控件存在问题,当您将其添加到舞台时,flashvars 开始不起作用。
只要不使用它,您的 flashvars 就会正常工作。
我遇到了同样的问题,我通过不使用 TLF TEXT 控件解决了这个问题。

There's a problem with the TLF TEXT control, when you add it to the stage the flashvars begins not working .
just don't use it and your flashvars will work fine .
i've faced the same problem and i got it solved by not using TLF TEXT control.

贪了杯 2024-10-02 13:36:04

var flashVars= LoaderInfo(this.root.loaderInfo).parameters;

这是关于如何执行此操作的冗长教程:
http://blog.six4rty.ch/tutorials/flash-flashvars-in- as3/

var flashVars= LoaderInfo(this.root.loaderInfo).parameters;

Here is a lengthy tutorial on how to do this:
http://blog.six4rty.ch/tutorials/flash-flashvars-in-as3/

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