How to go fullscreen in Flash?
我想创建一个让我的 Flash 全屏显示的按钮。
但是这一行:
1 | stage.displayState = StageDisplayState.FULL_SCREEN; |
... 不起作用。为什么?
(我直接在 Chrome 中打开我的 swf。)
编辑:
似乎有共识认为我应该嵌入 HTML。
有人可以提供一个片段吗?
我会选择 SWFObject,因为它适用于所有浏览器。检查这个:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> Go Fullscreen <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="js/swfobject.js"> <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); } </head> <body> <script type="text/javascript"> initFlash(); </body> </html> |
您可以在此处下载 swfobject javascript 文件并快速安装 swiff:
http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip
在生成的 html 中应该有一个变量/参数"allowFullScreen"。您需要将此设置为 true。
来自 http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html
1 2 3 4 5 6 7 8 9 10 | <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> |