Flex3 - 将flashvars传递给html包装器中的swf

时间:2012-05-15 15:04:46

标签: flex null flash flashvars

我遇到问题将flashvars传递给我的应用程序的swf。

我正在使用flex builder提供的默认模板,我按照adobe livedocs的说明添加了flashvars:

AC_FL_RunContent(
        "src", "playerProductInstall",
        "FlashVars", "MMredirectURL="+MMredirectURL+'&MMplayerType='+MMPlayerType+'&MMdoctitle='+MMdoctitle+'langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml'+"",
        "width", "100%", ...

AC_FL_RunContent(
        "src", "SOD",
        "FlashVars", "langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml",
        "width", "100%", ...

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
            id="SOD" width="100%" height="100%"
            codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
            <param name="movie" value="SOD.swf" />
            <param name="quality" value="high" />
            <param name="bgcolor" value="#869ca7" />
            <param name="allowScriptAccess" value="sameDomain" />
            <embed src="SOD.swf" quality="high" bgcolor="#869ca7"
                FlashVars="langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml"

我需要在应用程序的preinitialize状态下读取Application.application.parameters值。 似乎在这个阶段,flashvars已经被顶级应用程序所知。

使用firebug,我在AC_OETags.js中放置了断点,以查看AC_Generateobj是否获得了正确的参数并且确实正确。输出str等于:

<embed src="SOD.swf" width="100%" height="100%" align="middle" id="SOD" quality="high" bgcolor="#869ca7" name="SOD" allowScriptAccess="sameDomain" pluginspage="http://www.adobe.com/go/getflashplayer" FlashVars="langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml" type="application/x-shockwave-flash" > </embed>

尽管应用程序确实有flashvars;当我试图让它们处于preinitialize阶段时,我得到一个错误,说Application.application.parameters为null。

有没有人知道我做错了什么??

提前致谢:)


@mgraph

这是我现在的包装:

<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title></title>
        <script src="AC_OETags.js" language="javascript"></script>
        <style>
            body { margin: 0px; overflow:hidden }
        </style>
    </head>

    <body scroll="no">
        <noscript>
            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
                id="SOD" width="100%" height="100%"
                codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                <param name="movie" value="SOD.swf" />
                <param name="quality" value="high" />
                <param name="bgcolor" value="#869ca7" />
                <param name="allowScriptAccess" value="sameDomain" />
                <embed src="SOD.swf" quality="high" bgcolor="#869ca7"
                    width="100%" height="100%" name="SOD" align="middle"
                    play="true"
                    loop="false"
                    quality="high"
                    allowScriptAccess="sameDomain"
                    type="application/x-shockwave-flash"
                    pluginspage="http://www.adobe.com/go/getflashplayer">
                </embed>
            </object>
        </noscript>
    </body>
</html>

1 个答案:

答案 0 :(得分:0)

你应该这样做:

....
<param name="FlashVars" value="langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml" />
<embed src="SOD.swf" quality="high" bgcolor="#869ca7"
                FlashVars="langStyle=Styles_jp.swf&langId=jp_JP&langSource=jp_JP.xml"><embed>