|
代码如下:
复制内容到剪贴板
代码:
package fb.copyright{
import flash.ui.*
import flash.display.*
import flash.net.*
import flash.events.ContextMenuEvent
public class Copyright{
private var myName:String="作者:zjs35"
private var myUrl:String="http://zjs35.5dblog.com"
private var target:InteractiveObject
public function Copyright(target:InteractiveObject){
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 fb.copyright.*
var cr:Copyright=new Copyright(this)
欢迎大家多提高贵建议,共同学习 |
|