右键全屏as3
(as3)右键菜单全屏与退出全屏的切换 //舞台设置 stage.frameRate=24; //右键设置 var myContextMenu:ContextMenu = new ContextMenu(); removeDefaultItems(); addCustomMenuItems(); this.contextMenu = myContextMenu; function removeDefaultItems():void { myContextMenu.hideBuiltInItems(); var defaultItems:ContextMenuBuiltInItems = myContextMenu.builtInItems; } function addCustomMenuItems():void { var zuozhe:ContextMenuItem = new ContextMenuItem("制作人"); myContextMenu.customItems.push(zuozhe); var wangzhi:ContextMenuItem = new ContextMenuItem("博客",true); myContextMenu.customItems.push(wangzhi); var emaile:ContextMenuItem = new ContextMenuItem("邮箱",true); myContextMenu.customItems.push(emaile); var dizhi:ContextMenuItem = new ContextMenuItem("地址",true); myContextMenu.customItems.push(dizhi); var _close:ContextMenuItem = new ContextMenuItem("关闭",true); myContextMenu.customItems.push(_close); var _quanping:ContextMenuItem = new ContextMenuItem("全屏",true); myContextMenu.customItems.push(_quanping); wangzhi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, wz); _close.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, gb); _quanping.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, qp); } function wz(event:ContextMenuEvent):void { var url:URLRequest=new URLRequest("http://blog.163.com/liu888chang@126/"); navigateToURL(url,"_blank"); } function gb(event:ContextMenuEvent):void { fscommand("quit"); } function qp(event:ContextMenuEvent):void { stage.displayState="fullScreen"; myContextMenu.customItems.pop(); var _quanping:ContextMenuItem = new ContextMenuItem("退出全屏",true); myContextMenu.customItems.push(_quanping); _quanping.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, tcqp); } function tcqp(event:ContextMenuEvent):void { stage.displayState="normal"; myContextMenu.customItems.pop(); var _quanping:ContextMenuItem = new ContextMenuItem("全屏",true); myContextMenu.customItems.push(_quanping); _quanping.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, qp); } 调用全屏功能代码需通过触发事件才可以运行的,如onPress,onRelease事件; 在插入html 代码时需设置<param name="allowFullScreen" value="true" />; 经多次研究发现,如 html代码设置成<param name="wmode" value="opaque" />或<param name="wmode" value="transparent" />时,则全屏功能无效!也就是说只有flash窗口模块设置为window时,全屏功能才有效。