6 Replies Latest reply: Jan 12, 2012 10:07 PM by nam1490 RSS

    Nested Menus Not Appearing in a Custom Panel Fly-out Menu

    mlavie Community Member

      I tried to create a menu for a custom panel, using the example which David Clark graciously pointed out to me:

      http://cssdk.host.adobe.com/sdk/1.0/docs/WebHelp/programmers_guide/cus tomizing_the_ui.htm

       

      However, the nested menu items do not appear. I only see Item 1 and Item 2 (and the separator and Item 3), but not Item 2-1. I was expecting to see Item 2-1 nested under Item 2.

       

      I used the menu structure provided in the example (note that there is an error in the example - one of the closing tags is incorrectly specified as "<MenuItem/>" instead of "</MenuItem>"). Below is the corrected XML and my code:

       

      protected function createMenu():void

      {

         var xmlMenu:XML =
          <Menu>
            <MenuItem Id="item_1" Label="Item 1"/>
            <MenuItem Label="Item 2">
              <MenuItem Label="Item 2-1"/>
            </MenuItem>
            <MenuItem Label="---"/>
            <MenuItem Label="Item 3"/>
           </Menu>;

       

          CSXSInterface.instance.addEventListener(MenuClickEvent.FLYOUT_MENU_CLICK, menuClickHandler);
          var menuAdded:SyncRequestResult = CSXSInterface.getInstance().setPanelMenu(xmlMenu);
          if (SyncRequestResult.COMPLETE != menuAdded.status)
          {
           trace("Unable to add menu");
          }

      }

       

         public function menuClickHandler(event:MenuClickEvent):void
         {
             switch (event.menuName) //you can also use the menuId
          {
          case "Item 1":
          trace("Item 1 has been clicked");
          break;
          default:
          trace("clicked " + event.menuName);
          }
         }

       

      I'd appreciate it if somebody could tell me what I'm doing wrong.

       

      TIA,

      mlavie