DataGrid on the right pop-up menu

2010-03-29  来源:本站原创  分类:Flash  人气:264 

<? Xml version = "1.0" encoding = "utf-8"?>
<Mx: Application xmlns: mx = " http://www.adobe.com/2006/mxml "Layout =" absolute "mouseOver =" getMouseTarget (Event) "applicationComplete =" onAppCreated () ">

<mx:Script>

<! [CDATA [
import mx.events.MenuEvent;
import mx.controls.MenuBar;
import mx.managers.PopUpManager;
import mx.controls.Alert;
import flash.display.DisplayObject;
import mx.controls.Menu;
import flash.external.ExternalInterface;

private var mouseTarget: DisplayObject;
private var headerMenu: Menu;
private var bodyMenu: Menu;

private function onAppCreated (): void (
ExternalInterface.addCallback ("rightClick", onMouseRightButtonClicked);
)

private function onMouseRightButtonClicked (): void (
if (headerMenu! = null) headerMenu.hide ();
if (bodyMenu! = null) bodyMenu.hide ();
if (mouseTarget.toString (). search ("DataGridHeader")! = -1) (
headerMenu = Menu.createMenu (null, myMenuData, false);
headerMenu.labelField = "@ label";
headerMenu.show (stage.mouseX, stage.mouseY);
) Else if (mouseTarget.toString (). Search ("ListBaseContentHolder")! = -1) (
bodyMenu = Menu.createMenu (null, ContentHolder, false); / / create pop-up menu to specify the contents of the pop-up menu may
bodyMenu.labelField = "@ label"; / / specify the pop-up menu, showing the field
bodyMenu.addEventListener (MenuEvent.ITEM_CLICK, menuHandler); / / Click on the menu item specified in the response function
bodyMenu.show (stage.mouseX, stage.mouseY);
)

)

private function menuHandler (event: MenuEvent): void (
IF ( event.item. @ eventName == "delete "){// delete operation
Alert.show ("implementation of the delete menu operation !!!");
) Else IF ( event.item. @ eventName == "Baidu ") (
Alert.show ("Executive baidu menu operation !!!");
)
)

private function getMouseTarget (event: MouseEvent): void (
mouseTarget = DisplayObject (event.target);

)
]]>
</ Mx: Script>
<mx:DataGrid x="62" y="72">
<mx:dataProvider>
<mx:Object price="10"/>
<mx:Object p="20"/>
</ Mx: dataProvider>
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="price"/>
<mx:DataGridColumn headerText="Column 2" dataField="p"/>
<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</ Mx: columns>
</ Mx: DataGrid>
<mx:DataGrid x="425" y="72">
<mx:columns>
<mx:DataGridColumn headerText="Column 1" dataField="col1"/>
<mx:DataGridColumn headerText="Column 2" dataField="col2"/>
<mx:DataGridColumn headerText="Column 3" dataField="col3"/>
</ Mx: columns>
</ Mx: DataGrid>
<! - Define the menu data. This is an official example from livedoc ->
<mx:XML format="e4x">
<root>
<menuitem label="MenuItem A">
<menuitem label="SubMenuItem A-1" enabled="false"/>
<menuitem label="SubMenuItem A-2"/>
</ Menuitem>
<menuitem label="MenuItem B" type="check" toggled="true"/>
<menuitem label="MenuItem C" type="check" toggled="false"/>
<menuitem type="separator"/>
<menuitem label="MenuItem D">
<menuitem label="SubMenuItem D-1" type="radio" groupName="one" />
<menuitem label="SubMenuItem D-2" type="radio" groupName="one" toggled="true"/>
<menuitem label="SubMenuItem D-3" type="radio" groupName="one" />
</ Menuitem>
<menuitem type="separator"/>
<menuitem label="Custom View Source"/>
</ Root>
</ Mx: XML>

<mx:XML source="ContentHolderMenu.xml">

</ Mx: XML>
</ Mx: Application>

ContentHolderMenu.xml:

<? Xml version = "1.0" encoding = "utf-8"?>
<root>
<menuitem label=" Delete " eventName="delete"/>
<menuitem label=" Search " eventName="search">
<menuitem label=" Baidu " eventName="baidu"/>
<menuitem label=" Use google" eventName="google"/>
</ Menuitem>
</ Root>
</ Xml>

This article comes from CSDN blog, reproduced, please indicate the source: http://blog.csdn.net/aini281032/archive/2010/02/24/5322305.aspx

相关文章
  • smartrcp implementation sample right click menu 2010-06-12

    <?xml version="1.0" encoding="utf-8"?> <gui:RCPModule xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:gui="cn.smartinvoke.gui.*" xmlns:rcp="cn.smartinvoke.rcp.*" layout="vertical" creati

  • Example Java AWT menu demo 2010-10-29

    package com.jtang.zhe.java; import java.awt.*; import java.awt.event.*; import java.awt.CheckboxMenuItem; import java.awt.Frame; import java.awt.Menu; import java.awt.MenuBar; import java.awt.MenuItem; import java.awt.MenuShortcut; import java.awt.Po

  • 减少Menu分割线的间距 2015-04-22

    之前看到社区中有介绍怎样灵活使用右键菜单的文章.现在积累下来右键菜单的方式还是比较多的,让我们来初步了解一下: 1. 使用flash自带的右键菜单,通过ContextMenu来设置,这是twaver最早右键菜单的解决方法,但这种方式有一个不太好的地方是自带上了flash的信息,而且无法删除,因此很不方便. 2. 使用Menu,通过左键的方式来触发弹出Menu项.这个方式还是比较能够接受的,对于flash也没有版本的要求. 3. 使用Flash Player 11.2的新功能实现右键菜单,这种方式

  • Broad language formula (representing a meaning of a word "tactics) 2011-01-05

    Escape = break ~ escape the cycle case = case ~ case, as judged by the control object @ ╞ Slip = continue ~ to continue to do the next slide loop that I quit the default = default ~ in front of the gate is not the case, the default to do this or do =

  • [Change] progressive realization of imitation QQ interface (5): semi-transparent and opaque form controls 2010-03-19

    This shows the middle of the interface to achieve imitation QQ client area. QQ is the transparency of the interface can be adjusted, but not even adjust the transparency of the middle of the client area has become a semi-transparent. Guest areas are

  • Dtree constructed with dynamic tree, and right to achieve added. Modify. Delete 2010-08-30

    Recently to be a video web site management, which involves dynamic tree menu, used to manage the type of video, specifically, is to ask the video read from the database types of information, followed by building dynamic tree can be achieved through t

  • Visual C + + resources in the / Resource in visual C + + 2010-12-29

    http://blog.csdn.net/Joephia/archive/2008/06/06/2517159.aspx Visual C + + resources in the / Resource in visual C + + Table title FileID : 0803 Create : 08-06-06 PM Author : Joephia LastUpdate : 08-06-06PM Abstract: Visual C + + in use of resources W

  • the main window and child window grid information exchange 2010-12-30

    Written the day before yesterday and then double-click pop-up child window GRID, interactive content of information <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xml

  • Android Development 06 - menus and dialog box (on) 2011-05-13

    Android Development 06 - menus and dialog box (on) 1. Menu 1) The options menu and sub menu in the foreground when the Activity work, press the appropriate menu option will pop up menu. This function is needed to achieve the developer compiled, if th

  • ubuntu10.10 with Virtualbox installed under the mac OS X [amd CPU] to change the resolution 2011-06-17

    My computer is a thinkpad E10, 1.3GHz AMD K325's cpu, 4G memory, plus a virtual machine specifically for the play of 2G. Resolution 1366x768 When installed, tried EmpireEFI4AMD.iso, EmpireEFIv_1.XX.iso are not installed on, and finally with the Legac

  • SocksCapV2 + Socks2HTTP 2011-09-20

    Sockscap32 is a NEC developed so that all winsock applications can use socks proxy tool. It calls to the winsock library system with a "hat", all produced in sockscap environment applications will be sockcap the winsock calls intercepted in the

  • 快速开发WebUI jQuery MiniUI 2012-03-13

    jQuery MiniUI 网站 : http://www.miniui.com jQuery MiniUI - 快速开发WebUI. 包含控件:DataGrid.Tree.TreeGrid.Menu.Toolbar.Tabs.Layout.Panel.DatePicker.ComboBox.TreeSelect.TextBoxList等. 典型应用:页面布局.CRUD.Master/Detail.数据验证等. 技术亮点: 快速开发:使用Html配置界面,减少80%界面代码量. 易学易用:简单的

  • 推荐10款最热门jQuery UI框架 原创 2014-06-02

    在进行Web开发时,并非所有的库都适合你的项目,但你仍需要收藏一些Web UI设计相关的库或框架,以在你需要的时候,加快你的开发效率.本文为你推荐10款非常优秀的基于JQuery的Web UI设计框架 1.国产jQuery UI框架 (jUI) DWZ DWZ富客户端框架(jQuery RIA framework), 是中国人自己开发的基于jQuery实现的Ajax RIA开源框架. 设计目标是简单实用,快速开发,降低ajax开发成本. 欢迎大家提出建议,我们将在下一版本中进一步调整和完善功能.

  • stack overflow上对于各大编辑器同学的C/C++代码浏览能力的评比 2013-04-07

    c/c++ source code browser comparison, seeking opinion visual c++ 2010 express edition (the free one). Too bad, it does not bother to do any analysis work just complains it can't find the head files. BTW, that's why I never like visual c++; it always

  • DataGrid on the right pop-up menu 2010-03-29

    <? Xml version = "1.0" encoding = "utf-8"?> <Mx: Application xmlns: mx = " http://www.adobe.com/2006/mxml "Layout =" absolute "mouseOver =" getMouseTarget (Event) "applicationComplete =" onAp

  • javascript html js custom class linkage many drop-down menu, select Custom Linkage 2009-05-03

    One of the parameters are 1 menu structure: Menu Object var menu = [ {'val': '1', 'txt': 'value'}, {'val': '2 ->', 'menu': [ {'val': '2_1'}, {'val': '2_2'} ]}, {'val': '3 ->', 'menu': [ {'val': '3_1 ->', 'menu': [ {'val': '3_1_1'}, {'val': '3_1_2

  • javascript html js many custom class linkage floating menu, js produced menu 2009-05-03

    Procedures for Principle (recommended reading by reference to the code): Procedures are based on traditional floating menu to expand from here, let me talk about some more crucial or useful places: 【Function】 Delay A lot of people understand this is

  • [Change] progressive realization of imitation QQ interface (6): Special menu and built-in self-painted scroll bar 2010-03-19

    This demonstrates the interface to achieve imitation QQ shaped menu and scroll bar from the paint. QQ first explain how to implement the round menu, use the HOOK this, because the menu is a special window, can not FindWindow or by HMENU handle to get

  • CSS-right menu DIV TABLE 2010-04-20

    DIV: Dynamic changes in DIV: Always bug. Keep to the right will only increase the child nodes! XX.js: <div> <div script="refreshNode"> Refresh </ div> </ Div> Increase the child nodes: Set well with the style and attribut

  • flex custom context menu 2010-04-22

    The first step: to http://rightclickmanager.googlecode.com/ Download rightclickmanager-source-lib-0.1.rar and the introduction of FLEX own project, which is the right click event, and full-screen close the system context menu key! Step Two: Open: <ma