swfobject not callingback swffit

swfobject not callingback swffit

本文关键字:swffit callingback not swfobject      更新时间:2023-09-26

我有一个闪存对象,它读取一些flashvars,我需要适应最小大小1000x600的闪存对象。如果它更大,那么它应该是100%x100%。所以我使用swfit,我需要通过GET从php设置flashvars,flash内容是液态的。如果我使用100%的宽度和100%的高度,它可以完美地工作,但正如我所说,如果你使用1000x600以下的分辨率,闪光对象上的一些元素看起来不太好,这是代码:

<!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>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>My HTML Title</title>
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript" src="swffit.js"></script>
        <script type="text/javascript">
            var flashvars = {
                section:" <?php if (isset($GET_['section'])) { echo $GET_['section']; } else { echo 'home'; } ?>",
                previewid:" <?php if (isset($GET_['previewid'])) { echo $GET_['previewid']; } else { echo 'null'; } ?>",
                previewlikes:" <?php if (isset($GET_['previewlikes'])) { echo $GET_['previewlikes']; } else { echo 'null'; } ?>",
                previewdate:" <?php if (isset($GET_['previewdate'])) { echo $GET_['previewdate']; } else { echo 'null'; } ?>",
                previewurl:" <?php if (isset($GET_['previewurl'])) { echo $GET_['previewurl']; } else { echo 'null'; } ?>"
            };
            var params = {
                quality: "high",
                scale: "noScale",
                wmode: "transparent",
                allowscriptaccess: "always",
                bgcolor: "#000000"
            };
             var attributes = {
                id: "Container",
                name: "Container"
            };
            swfobject.embedSWF("Container.swf", "Container", "1000", "600", "9.0.0", false, flashvars, params, attributes, callbackHandler);
            var callbackHandler = function (e)
            {
                if (e.success)
                {
                    swffit.fit("Container",1000,600,2048,1536,false,false);
                }
            }
        </script>
        <style type="text/css">
            body
            {
                background-color: #000000;
            }
        </style>
    </head>
    <body>
        <div id="Container">
            <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" title="Get Adobe Flash player"/></a><br/>
            You need <a href="http://www.adobe.com/go/getflashplayer">Flash Player 9</a> and allow javascript to see the content of this site..
        </div>
    </body>
</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>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
        <title>My Title</title>
        <script type="text/javascript" src="swfobject.js"></script>
        <script type="text/javascript" src="swffit.js"></script>
        <script type="text/javascript">
            var flashvars = {
                section:" <?php if (isset($GET_['section'])) { echo $GET_['section']; } else { echo 'home'; } ?>",
                previewid:" <?php if (isset($GET_['previewid'])) { echo $GET_['previewid']; } else { echo 'null'; } ?>",
                previewlikes:" <?php if (isset($GET_['previewlikes'])) { echo $GET_['previewlikes']; } else { echo 'null'; } ?>",
                previewdate:" <?php if (isset($GET_['previewdate'])) { echo $GET_['previewdate']; } else { echo 'null'; } ?>",
                totalimages:" <?php if (isset($GET_['totalimages'])) { echo $GET_['totalimages']; } else { echo 'null'; } ?>"
            };
            var params = {bgcolor:"#000000"};
            var attributes = {id: "flash"};
            swfobject.embedSWF("Container.swf", "flash", "1000", "600", "9.0.0","",flashvars, params, attributes);
            swffit.fit("flash",1000,600,2048,1536);
        </script>
        <style type="text/css">
            body{
                background-color: #000000;
            }
        </style>
    </head>
    <body>
        <div id="flash">
            <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" title="Get Adobe Flash player" /></a><br />
            You need <a href="http://www.adobe.com/go/getflashplayer">Flash Player 9</a> and allow javascript to see the content of this site..
        </div>
    </body>
</html>