Flex 添加右键菜单

来源:互联网 发布:淘宝代运营价格 编辑:程序博客网 时间:2024/06/06 00:27
// 添加右键private function AddRightKeyMenu( ) : void {var rightMenu : ContextMenu = new ContextMenu( );  var keyPointMenu : ContextMenuItem = new ContextMenuItem( "获取当前经纬度" );  keyPointMenu.addEventListener( ContextMenuEvent.MENU_ITEM_SELECT, OnGetPointPos );  rightMenu.customItems.push( keyPointMenu );  rightMenu.hideBuiltInItems();map.contextMenu = rightMenu;}private function OnGetPointPos( event : ContextMenuEvent ) : void {var  mapPoint : MapPoint = this.map.toMapFromStage( event.mouseTarget.mouseX, event.mouseTarget.mouseY );if (mapPoint != null){var mapXY : String = mapPoint.x.toFixed(8) + ", " + mapPoint.y.toFixed(8);System.setClipboard( mapXY );} }

原创粉丝点击