zoukankan      html  css  js  c++  java
  • 右键全屏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时,全屏功能才有效。 
  • 相关阅读:
    基础普及-Jar、War、Ear
    Guice 学习(五)多接口的实现( Many Interface Implementation)
    Foundation框架
    windowsclient开发--使用、屏蔽一些快捷键
    数据结构(Java语言)——BinaryHeap简单实现
    最小生成树之Prim(普里姆)算法
    LeetCode--Remove Element
    Java实现算法之--选择排序
    kvm云主机使用宿主机usb设备
    Oracle12c Client安装出现"[INS-30131]"错误“请确保当前用户具有访问临时位置所需的权限”解决办法之完整版
  • 原文地址:https://www.cnblogs.com/regalys168/p/4832706.html
Copyright © 2011-2022 走看看