0

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

<!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>
4

1 回答 1

0

已修复,对于有相同错误的人,这里有一个解决方案:

<!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>
于 2013-07-05T16:35:45.400 回答