AS3.0文档类:FLASH右键菜单文档类

代码
package {
 import flash.ui.
*
 import flash.display.
*
 import flash.net.
*
 import flash.events.ContextMenuEvent
 public class copyright{
 private 
var  myName:Array  =   new  Array( " 闪客居 " " Flash_Action_Script " " www.flashas.net " );
 private 
var  myUrl:String = " http://www.flashas.net "
 private  
var  i:Number;
 private 
var  num:Number = 3 ;
 private 
var  target:InteractiveObject
 public 
function  copyright(target:InteractiveObject){
   
this .target = target
   
this .myItem()  
  }
  private 
function  myItem(): void {
  
var  myContextMenu  =   new  ContextMenu();
  myContextMenu.hideBuiltInItems();
  
for  (i = 0 ;i < num;i ++ ){    
   
var  item:ContextMenuItem = new  ContextMenuItem(myName[i]);  
   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 " )
  
  }
 }
}

 

你可能感兴趣的:(Flash)