1 Reply Latest reply on Jun 18, 2010 3:45 AM by MoreGart111

    Custom Menu in Flex. Why does the 'Delete' menu not show up ?

    MoreGart111

      Please look at the following code. I have added three custom context menu items but only two show up on running the app.

       

      <?xml version="1.0" encoding="utf-8"?>

      <mx:Application

      initialize="init(event)" xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

      <mx:Script>

      <![CDATA[

      public

      function init(event:Event):void

      {

      var menuItem1:ContextMenuItem = new ContextMenuItem("Add");

      var menuItem2:ContextMenuItem = new ContextMenuItem("Delete");

      var menuItem3:ContextMenuItem = new ContextMenuItem("Edit");

      var customContextMenu:ContextMenu = new ContextMenu();

      //hide the Flash menu

      customContextMenu.hideBuiltInItems();

      customContextMenu.customItems.push(menuItem1);

      customContextMenu.customItems.push(menuItem2);

      customContextMenu.customItems.push(menuItem3);

      myPanel.contextMenu = customContextMenu;

      }

      ]]>

      </mx:Script>

      <mx:Panel

      id="myPanel" height="100%" width="100%"></mx:Panel>

      </mx:Application>