1 Reply Latest reply on Jul 29, 2011 7:48 AM by chrisp4d

    Handling the right click

    Cédric Opfemann



      My application needs a right click management other than the default flash plugin right click.

      After some research, it seems that it is possible to do it using Javascript in Flex 2 and 3.

      As I'm using Flex 4.5, I tried to implement the same mechanism but I can't get it work.


      Does anyone has done it in Flex 4.5 maybe natively ?

        • 1. Re: Handling the right click

          Not sure if this will help, but here's how to make a right click context menu with Flex 4.  it will still have the stupid flash player options, but at least you can add your own menu options to it as well.  Sorry if it's not what you'd like, but i didn't know if it would help!




                       private var cm:ContextMenu;


                      private function initCM():void {
                           var cmi:ContextMenuItem = new ContextMenuItem("Menu Option 1", true);
                           cmi.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, selectMenu1);
                           var cmi2:ContextMenuItem = new ContextMenuItem("Menu Option 2", true);
                           cmi2.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, selectMenu2);
                           cm = new ContextMenu();
                           cm.customItems = [cmi,cmi2];
                           cm.addEventListener(ContextMenuEvent.MENU_SELECT, contextMenu_menuSelect);
                       private function contextMenu_menuSelect(evt:ContextMenuEvent):void {
                           //do something whenever the context menu pops up regardless of selecting a menu item.
                       private function selectMenu1(evt:ContextMenuEvent):void {
                           //menu option 1 has been selected

                         Alert.show('Menu Option 1 Selected');


                      private function selectMenu2(evt:ContextMenuEvent):void {

                          //menu option 2 has been selected

                         Alert.show('Menu Option 2 Selected');