[英]How to go fullscreen in Flash?
I would like to create a button that makes my flash fullscreen. 我想创建一个按钮,使我的闪光全屏。 But this line:
但这一行:
stage.displayState = StageDisplayState.FULL_SCREEN;
... does not work. ......不起作用。 Why?
为什么? (I'm opening my swf directly in Chrome.)
(我正在Chrome中直接打开我的swf。)
Edit: There seem to be consensus that I should embed in HTML. 编辑:似乎已经达成共识,我应该嵌入HTML。
Can somebody provide a snippet? 有人可以提供一个片段吗?
I would go for SWFObject as it works fine for every browsers. 我会选择SWFObject,因为它适用于每个浏览器。 Check this one:
检查一下:
<!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>
You can download the swfobject javascript file and expressinstall swiff here: http://code.google.com/p/swfobject/downloads/detail?name=swfobject_2_2.zip&can=2&q= 您可以在此处下载swfobject javascript文件和expressinstall swiff: http : //code.google.com/p/swfobject/downloads/detail? name = swfobject_2_2.zip&can = 2&q =
Good luck, Rob 祝你好运,Rob
In the generated html there should be a variable/parameter "allowFullScreen". 在生成的html中应该有一个变量/参数“allowFullScreen”。 You need to set this to true.
您需要将此设置为true。
From http://www.adobe.com/devnet/flashplayer/articles/full_screen_mode.html 来自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>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.