flash cs3添加右键菜单
flash cs3添加右键菜单
flash cs3的右键菜单 ContextMenu 对象附加到特定的按钮、影片剪辑或文本字段对象,也可以附加到整个影片级别。
所以这里设置一个背景影片剪辑st,然后添加如下代码:
var menuItem:ContextMenuItem = new ContextMenuItem("浪子设计");
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,gotoAuthorPage);
var customContextMenu:ContextMenu = new ContextMenu();
customContextMenu.hideBuiltInItems();
customContextMenu.customItems.push(menuItem);
st.contextMenu = customContextMenu;
function gotoAuthorPage(event:ContextMenuEvent):void {
var targetURL:URLRequest = new URLRequest("http://www.flasc.cn/");
navigateToURL(targetURL);
}
所以这里设置一个背景影片剪辑st,然后添加如下代码:
var menuItem:ContextMenuItem = new ContextMenuItem("浪子设计");
menuItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT,gotoAuthorPage);
var customContextMenu:ContextMenu = new ContextMenu();
customContextMenu.hideBuiltInItems();
customContextMenu.customItems.push(menuItem);
st.contextMenu = customContextMenu;
function gotoAuthorPage(event:ContextMenuEvent):void {
var targetURL:URLRequest = new URLRequest("http://www.flasc.cn/");
navigateToURL(targetURL);
}
补充:flash教程,Action