2 Replies Latest reply on Jan 31, 2008 2:01 PM by Arty13

    Context Menu - Edit Menu Help

    Arty13 Level 1
      Currently using Flex 2,

      I am using a TextArea and it has a default ContextMenu of "edit menu". The edit menu consists of Cut, Copy, Paste, Delete, and Select All. I am trying to dispatch an event to programatically call a certain menu item. My problem is, I do not know which event is triggering the edit context menu when I select Cut, Copy, Paste, Delete, or Select All.
      Does anyone know which events trigger these items or where the addEventListeners are declared?

      Thanks,

      Arty
        • 1. Re: Context Menu - Edit Menu Help
          Ratsnackbar Level 2
          Yeah here's a slice of code from one of my menus that may help.

          private function addContextMenuItems():void{
          var newItem:ContextMenuItem = new ContextMenuItem(newMenuItem);
          this.contextMenu.customItems.push(newItem);
          if(!newItem.hasEventListener(ContextMenuEvent.MENU_ITEM_SELECT)){
          newItem.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, menuItemSelectHandler,false,0,true);
          }
          }
          • 2. Re: Context Menu - Edit Menu Help
            Arty13 Level 1
            Ratsnackbar, thanks for your input, but thats not quite what I'm looking for.

            Pretty much this is what I want to do is create an event and dispatch it so it mimics the context menu item select for Cut, Copy, etc...

            For example...
            ***************************
            var myEvent:ContextMenuEvent = new ContextMenuEvent();
            myEvent.type = ContextMenuEvent.MENU_ITEM_SELECT;
            myEvent.
            ... etc...

            [handle on object/menu].dispatchEvent(myEvent);
            ***********************

            I need to know what the correct events I need to dispatch and what the handle is to the default context menu.

            Thanks.