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 开发者_C百科in Chrome.)
Edit: There seem to be consensus that I should embed in HTML.
Can somebody provide a snippet?I would go for SWFObject as it works fine for every browsers. 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=
Good luck, Rob
In the generated html there should be a variable/parameter "allowFullScreen". You need to set this to true.
From 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>
精彩评论