0

我有一个 .swf 文件和一个备用 .gif 文件。

我想在响应式 Flash Player 中播放它们。如果没有 Flash 可以播放 gif。我找到了一个使用 swfobject 的解决方案,但它的宽度和高度都是固定的。还有其他解决方案吗?问候彼得

4

1 回答 1

0

我有同样的问题,我尝试过这样的事情。

swfobject 的高度存在问题,我仍在努力:

<!DOCTYPE html>
<html lang="fr">
    <head>
        <meta charset="UTF-8">
        <title>Flash responsive</title>
        <!-- IE6-8 support elements HTML5 -->
        <!--[if lt IE 9]><script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <style>
        #mainContainer {
            width: 100%;    // try with another value (like 500px)
            height: 100%;   // idem
            display: block;
        }
    </style>
    </head>

    <body>
        <div id="mainContainer"></div>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js"></script>
        <script>
            var widthSwf  = '100%';
            var heightSwf = '100%';
            var urlSwf    = "Path/to/file.swf";
            var urlGif    = "Path/to/file.gif";

            var responsiveFlash  = '<div id="swfContainer">';
                responsiveFlash += '<img id="gif_backup" width="' + widthSwf + 'px" height="'+ heightSwf + 'px" src="' + urlGif + '" />';
                responsiveFlash += '</div></div>';

            var params = {
                quality: "high",
                wmode: "opaque",
                allowScriptAccess: "always",
                allowfullscreen : "always",
                type: "application/x-shockwave-flash",
                scale: "exactFit",
                pluginspage: "http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"
            };

            var attributes = {
                id : "mySwf"
            };

            swfobject.embedSWF(urlSwf, "swfContainer", widthSwf, heightSwf, "9", false, false, params, attributes);

            var mainContainer = document.getElementById('mainContainer');
                mainContainer.innerHTML = responsiveFlash;
        </script>
    </body>
</html>

希望有帮助。

ps:swfobject 的比例文档:http ://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002154.html

于 2013-12-10T11:05:42.477 回答