这是我将按钮添加到舞台上的代码
private function add_fullScreenBtn(height:Number):void
{
button_fullScr = new Sprite();
button_fullScr.useHandCursor = true;
button_fullScr.buttonMode = true;
button_fullScr.mouseChildren = false;
button_fullScr.x = height;
button_fullScr.y = btn_y;
var fullScr_Btn:Bitmap = new fullScreenImage();
button_fullScr.addChild(fullScr_Btn);
button_fullScr.addEventListener(MouseEvent.CLICK, fullScreenHandler);
addChild(button_fullScr);
}
这是用户单击全屏按钮时处理事件的代码
private function fullScreenHandler(event:MouseEvent):void
{
trace("Here");
// stage.displayState = StageDisplayState.FULL_SCREEN
if (this.stage.displayState== StageDisplayState.NORMAL) {
//stage.displayState="fullScreen";
this.stage.displayState=StageDisplayState.FULL_SCREEN_INTERACTIVE;
stage.scaleMode = StageScaleMode.NO_SCALE;
} else {
//stage.displayState="normal";
this.stage.displayState=StageDisplayState.NORMAL;
}
}
这是html页面的代码
<html>
<head>This is the Test Page
</head>
<body>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
codebase="http://.../swflash.cab#version=9,0,0,0"
width="550" height="400" id="sample" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="allowFullScreen" value="true" />
<param name="movie" value="sample.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#333333" />
<embed src="sample.swf" quality="high" bgcolor="#333333"
width="550" height="400"
name="sample" align="middle"
allowscriptaccess="sameDomain"
type="application/x-shockwave-flash"
allowFullScreen="true"
pluginspage="http://www.macromedia.com/go/getflashplayer" />
</embed>
</object>
</body>
</html>
当我运行此页面时,我收到不允许全屏模式的错误。安全异常。当我在控制台上跟踪它时,它的打印“here”
谁能建议我如何解决错误