看到官方的一片讲解如何在Flash Player 9下全屏幕显示Flash的文章,原文地址如下:
package

...
{
import flash.display.Sprite;
import flash.ui.ContextMenu;
import flash.ui.ContextMenuItem;
import flash.events.ContextMenuEvent;
import flash.display.StageScaleMode;
import flash.display.StageDisplayState;
import flash.system.Security;
import flash.system.SecurityPanel;
import flash.system.fscommand;

public class FullScreen_demo extends Sprite

...{
public function FullScreen_demo()

...{
// create the context menu, remove the built-in items,
// and add our custom items
var fullscreenCM:ContextMenu = new ContextMenu();
fullscreenCM.addEventListener(ContextMenuEvent.MENU_SELECT, menuHandler);
fullscreenCM.hideBuiltInItems();
var fs:ContextMenuItem = new ContextMenuItem("Go Full Screen" );
fs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, goFullScreen);
fullscreenCM.customItems.push( fs );
var xfs:ContextMenuItem = new ContextMenuItem("Exit Full Screen");
xfs.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, exitFullScreen);
fullscreenCM.customItems.push( xfs );
// finally, attach the context menu to a movieclip
this.contextMenu = fullscreenCM;
}

private function goFullScreen(e:ContextMenuEvent):void...{
this.stage.displayState = StageDisplayState.FULL_SCREEN; //设置为全屏
}

private function exitFullScreen(e:
ContextMenuEvent
):void...{
this.stage.displayState = StageDisplayState.NORMAL;
}

private function menuHandler(e:ContextMenuEvent):void...{
if (stage.displayState == StageDisplayState.NORMAL)

...{
e.target.customItems[0].enabled = true;
e.target.customItems[1].enabled = false;
}
else

...{
e.target.customItems[0].enabled = false;
e.target.customItems[1].enabled = true;
}
}
}
}
<
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
>
<
script
type
="text/javascript"
src
="swfobject.js"
></
script
>

<
style
type
="text/css"
>
...
body

{...}{
background-color: #869ca7;
}
</
style
>
</
head
>

<
body
>
<
div
id
="fabchannel_base_templateContainer"
>
You need the Flash Player version 9.0.18.60 or higher and a JavaScript enabled browser to view this site
</
div
>

<
script
type
="text/javascript"
>
...
// <!--

var ignoredParams = ...{src: 1, bgcolor: 1};
var params = String('src="FullScreen_demo.swf" menu="true" quality="high" bgcolor="#869ca7" ').split(" ");
var swf = new SWFObject("FullScreen_demo.swf", "fabchannel_base_template", "960", "605", "9.0.18.60", "#869ca7");
swf.addParam("align", "middle");
swf.addParam("allowFullScreen", "true");
for(var i = 0; i < params.length; i++)

...{
var paramName = params[i].split("=")[0];
var paramValue = params[i].split(""")[1];
if(ignoredParams[paramName] != 1 && paramName != "")

...{
swf.addParam(paramName, paramValue);
}
}
swf.write("fabchannel_base_templateContainer");
// -->
</
script
>
</
body
>
Exploring full-screen mode in Flash Player 9 ,照葫芦画弧,这里我只贴一下AS3的代码:






























































根据说明再修改HTML文件内容:










关键是这一句:<param name="allowFullScreen" value="true" /> ,一切就绪后,运行,却弹出如下错误:
SecurityError: Error #2152: 不允许使用全屏模式。
奇怪了,怎么不行呢,google一番,也没查到具体原因,却找到另一个方法实现全屏,一个SWFObject.js脚本(地址:http://blog.deconcept.com/swfobject/),做起来也挺简单,SWF代码都不变,改一下HTML文件,内容如下:






































只要把上面红色字的改成你的swf文件就可以了,是不是很简单,现在还不明白官方的那个例子怎么不行了,希望知情者告知,谢谢。