Why is my flash object not displayed correctly?

时间:2016-08-30 04:44:01

标签: javascript flash firefox flex iframe

I have a problem with a flash game. I have to implement it in an iframe on a webpage, that has to run in Firefox. The game itself is a own webpage, which loads the flash object with the library swfobject. If I open directly the game in Firefox, it loads and is playable. If I open the Developer-Tools, then the video of the game gets hidden, all I see is a white page. The music is still running.

The strange behavior is, that when i click on the body tag, the game is not visible. If i click on the header tag, the game is visible. When I open the game in the iframe, it is not visible, like when the Developer-Tools are open.

I have some other games which loads perfect. The difference between them is the wmode. The game that doesn't work uses the wmode "gpu". The others "transparent". But the game itself needs the wmode gpu or direct, because it uses Stage3D or something.

The iframe is loaded in an md-dialog from the angular-material library. Also I use AngularJS.

The game is working perfectly in Chrome!

Do someone know how to solve this?

This is in the index.html of the game.

<script type="text/javascript">
        // For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection. 
        var swfVersionStr = "11.1.0";
        // To use express install, set to playerProductInstall.swf, otherwise the empty string. 
        var xiSwfUrlStr = "playerProductInstall.swf";
        var flashvars = {};
        var params = {};
        params.quality = "high";
        params.bgcolor = "#ffffff";
        params.allowscriptaccess = "sameDomain";
        params.allowfullscreen = "true";
        params.wmode = "gpu";
        //params.scale = "noborder";
        var attributes = {};
        attributes.id = "Flash";
        attributes.name = "Flash";
        attributes.align = "middle";
        swfobject.embedSWF(
            "flash.swf", "flashContent", 
            "1180", "660", 
            swfVersionStr, xiSwfUrlStr, 
            flashvars, params, attributes);
        // JavaScript enabled so display the flashContent div in case it is not replaced with a swf object.
        //swfobject.createCSS("#flashContent", "display:block;text-align:left;");
    </script>

The index.html is getting loaded with:

<iframe id="iframe" scrolling="no"></iframe>

$('#iframe').attr('src',vm.urlD);

where vm.urlD is the parsed URL for the games index.html.

css sytles iframe:

iframe{
left: 0;
top: 0;
right: 0;
bottom: 0;
margin: auto;
height: 100%;
width: 100%;
overflow: hidden;
border: none;}

1 个答案:

答案 0 :(得分:0)

您是否设置了iframe的尺寸?如果您没有修复容器元素的大小,有时flash嵌入在某些浏览器中效果不佳。它只是在你改变浏览器的大小(比如打开开发人员工具或调整窗口大小等等)之前一直工作。

示例:

<iframe width="500px" height="500px" src="..."></iframe>

PS:您应该向人们展示您为此做的代码,以便获得正确的答案。