package showimg{
  import flash.ui.*;
  import flash.display.*;
  import flash.net.*;
  import flash.events.ContextMenuEvent;  public class Copyright extends Sprite {
    private var myName:String=”作者:设计三人行”;
    private var myUrl:String=”http://www.srxtuan.com“;
    private var target:InteractiveObject;
    public function Copyright(target:InteractiveObject):void {
      this.target=target;
      this.removeAndAddItem();
    }
    private function removeAndAddItem():void {
      var myContextMenu = new ContextMenu();
      var item:ContextMenuItem=new ContextMenuItem(myName);
      myContextMenu.hideBuiltInItems();
      myContextMenu.customItems.push(item);
      target.contextMenu=myContextMenu;
      item.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, itemSelectHandler);
    }
    private function itemSelectHandler(e:ContextMenuEvent):void {
      navigateToURL(new URLRequest(myUrl),”_blank”);
    }
  }
}

用法:
import showimg.Copyright;
var cr:Copyright=new Copyright(this);

    博视界科技专注于沉浸式全景数字餐厅、全息酒店宴会厅,旨在帮传统餐饮用科技玩跨界,欢迎咨询!

官方网站:www.boseetech.com

联系方式:    

关注我们:


    【声明】转载本文请注明出处三人行设计,并保留有效链接:[Flash AS3实例教程]给AS3添加右键菜单 http://www.srxtuan.com/archives/984,谢谢!