开发者

How do you initialize a full-window Flash object in Google Chrome?

开发者 https://www.devze.com 2023-02-07 06:34 出处:网络
I have a simple HTML file which embeds a Flash file. On the page styling I have a #flashContent with width:100% and height:100%; the Flash object itself has width=\"100%\" and height=100% and is insid

I have a simple HTML file which embeds a Flash file. On the page styling I have a #flashContent with width:100% and height:100%; the Flash object itself has width="100%" and height=100% and is inside a div with id="flashContent"开发者_运维知识库. The idea is to make the Flash object (which is a game) to fill the whole browser window even as it resizes.

This works with no problems on IE and Firefox, but there is a small problem on Chrome. About 90% of the time when the page first loads all that is shown is black (the page's background color). The game only appears if the user resizes the window; from then on out it works correctly.

I'd like to ask if there is anything I am doing wrong or if there is an workaround to ensure the Flash game appears correctly on the Chrome browser.


http://reisio.com/examples/fullflash/

<!doctype html>
<html>
    <head>
        <title></title>
        <style>
* {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}
        </style>
    </head>
    <body>
        <div>
            <object 
                data="Flash.swf" 
                type="application/x-shockwave-flash" 
                width="400" 
                height="300">
                <param 
                    name="movie" 
                    value="Flash.swf">
            </object>
        </div>
    </body>
</html>


Try using exact (or very big) length for the height, not percents. I had similar problem and I solved it by indicating exact height instead of 100%

but I also use AC_FL_RunContent(...), and in my case the actual height generation was happening there, and there is actually where I had to set the height and for some reason it wasn't setting it to 100% in Chrome. Other browsers work fine though. Below is the code:

           <script>
              AC_FL_RunContent(
                  "src", "flash/ConstructionKit03",
                  "width", "100%",
                  "height", "740",
                  "align", "middle",
                  "id", "ConstructionKit03",
                  "quality", "high",
                  "bgcolor", "#869ca7",
                  "name", "ConstructionKit03",
                  "flashvars",'historyUrl=history.htm%3F&lang=<%=userLanguage%>&initialUrl=<%=workflow_url%><%=(!edit.equals("") ? "&initialState=editable" : "" )%>&lconid=' + lc_id + '',
                  "allowScriptAccess","sameDomain",
                  "type", "application/x-shockwave-flash",
                  "pluginspage", "http://www.adobe.com/go/getflashplayer"

            </script>

              <object id="ConstructionKit03" width="100%" height="740"
                  codebase="http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab">
                  <param name="movie" value="ConstructionKit03.swf" />
                  <param name="quality" value="high" />
                  <param name="bgcolor" value="#869ca7" />
                  <param name="allowScriptAccess" value="sameDomain" />
                  <embed src="flash/ConstructionKit03.swf" quality="high" bgcolor="#869ca7" 
                    width="100%" height="740" name="ConstructionKit03" align="middle"
                    play="true"
                    loop="false"
                    quality="high"
                    allowScriptAccess="sameDomain"
                    type="application/x-shockwave-flash"
                    pluginspage="http://www.adobe.com/go/getflashplayer">
                  </embed>
              </object>
0

精彩评论

暂无评论...
验证码 换一张
取 消