0 Replies Latest reply on Jul 6, 2007 6:52 AM by Sander Kruger

    Erratic context menu

    Sander Kruger
      So, we know we can't hide the context menu entirely. But we can remove unwanted items and add our own items. Or can we?

      It looks like Flex wants to decide for itself whether it wants to show your custom contextMenu or the full-blown default one. The following code snippet shows the problem:


      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="changeMenu()">
      <mx:Script>
      <![CDATA[
      import mx.controls.Alert;
      public function changeMenu() :void
      {
      contextMenu.hideBuiltInItems();
      }

      public function showPopUp() :void
      {
      Alert.show( "Try the context menu now", "This is a popup" );
      }
      ]]>
      </mx:Script>
      <mx:Button x="324.5" y="227" label="Show Popup" click="showPopUp()">
      </mx:Button>
      </mx:Application>



      You'll notice that when the popup shows, both the popup and the blurred area around it will have a full context menu, not the one in which most items are hidden.

      As a work-around, you can manually assign the default context menu to any misbehaving component, but that seems like a bad solution. Besides, it doesn't solve the problem that the blur under a modal window has the wrong context menu.

      If anyone has a solution, of if Adobe would be so kind to offer one, I'd be very happy.