如何在Flash中全屏?

时间:2011-03-08 09:35:02

标签: html flash flex actionscript-3

我想创建一个按钮,让我的flash全屏显示。 但是这一行:

stage.displayState = StageDisplayState.FULL_SCREEN;

......不起作用。为什么? (我正在Chrome中直接打开我的swf。)

编辑: 似乎已经达成共识,我应该嵌入HTML 有人可以提供一个片段吗?

3 个答案:

答案 0 :(得分:3)

我会选择SWFObject,因为它适用于每个浏览器。检查一下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
    <head>
        <title>Go Fullscreen</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <script type="text/javascript" src="js/swfobject.js"></script>
        <script type="text/javascript">                 
            var fo = new Object();
            function initFlash()
            {
                fo.flashvars = {};
                fo.params = {
                    allowScriptAccess: "always",
                    allowFullScreen: "true"
                };
                fo.attributes = {};         
                swfobject.embedSWF("swf/FlashFile.swf", "flashcontent", "100%", "100%", "10", "swf/expressInstall.swf", fo.flashvars, fo.params, fo.attributes);
            }
        </script>
    </head>
    <body>
        <div id="flashcontent"></div>
        <script type="text/javascript">
            initFlash();
        </script>
    </body>
</html>

您可以在此处下载swfobject javascript文件和expressinstall swiff: http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip&can=2&q=

祝你好运, 罗布

答案 1 :(得分:1)

在生成的html中应该有一个变量/参数“allowFullScreen”。您需要将其设置为true。

答案 2 :(得分:0)

来自http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
 codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,18,0"
 width="600"  height="400" id="fullscreen" align="middle">
<param name="allowFullScreen" value="true" />
<param name="movie" value="fullscreen.swf" />
<param name="bgcolor" value="#333333" />
<embed src="fullscreen.swf" allowFullScreen="true" bgcolor="#333333" width="600" height="400"
 name="fullscreen" align="middle" type="application/x-shockwave-flash" 
 pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>