具有备用gif文件的响应式Flash Player

时间:2013-09-05 09:19:28

标签: flash responsive-design gif swfobject

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

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

1 个答案:

答案 0 :(得分: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