2013-04-15 63 views
1

这是我的代码添加按钮拖到舞台动作全屏不允许

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> 

当我运行此页面时出现全屏模式为错误不允许。安全例外。当我跟踪它在控制台上的印刷“这里”

任何人都可以建议我怎么能解决这个错误

+0

是这个网站的唯一一个?通常有静态HTML,也是由javascript生成的 - 请检查其参数。 – Miha

+0

这是一个静态html。 – Jack

回答

0

我不得不添加行缩放图像,即添加以下行

stage.scaleMode = StageScaleMode.NO_SCALE; 

stage.displayState = StageDisplayState.FULL_SCREEN; 

和它的工作