Onelong

分享知识,与你一起进步......
RSS icon Home icon
  • ActionScript3 修改右键菜单的方法

    post by onelong / 2010-4-14 23:15 Wednesday [MXML/ActionScript3.0]

    方法一:
    var zcd:ContextMenu=new ContextMenu();//上下文菜单
    zcd.hideBuiltInItems();//隐藏所有右键菜单
    zcd.builtInItems.print=true;//显示打印菜单
    this.contextMenu=zcd;

    方法二:
     var zcd:ContextMenu=new ContextMenu();//上下文菜单
    var nzcd:ContextMenuBuiltInItems=new ContextMenuBuiltInItems();
    nzcd.print=false;//隐藏打印菜单
    nzcd.quality=false;//隐藏品质菜单
    zcd.builtInItems=nzcd;
    this.contextMenu=zcd;

    this.stage.showDefaultContextMenu=false;//隐藏右键菜单

    方法三:
    var zcd:ContextMenu=new ContextMenu();//上下文菜单
    zcd.hideBuiltInItems();//隐藏所有右键菜单
    this.contextMenu=zcd;//重新赋值,改变右键菜单

    方法四:
    var zcd:ContextMenu=new ContextMenu();//上下文菜单
    zcd.builtInItems.print=false;//隐藏所有右键菜单
    this.contextMenu=zcd;

    自定义菜单:
     

    var zcd:ContextMenu=new ContextMenu();//上下文菜单

    var news:ContextMenuItem=new ContextMenuItem("我的菜单");//新建自定义菜单

    zcd.customItems.push(news);//加入右键菜单组

    this.contextMenu=zcd;

    news.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,slectHandle);//添加选择事件

    引用地址:
     

    我要评论