1 Reply Latest reply on May 9, 2012 12:00 PM by orionstar15

    Flex submenu's problem

    wayswssb

      Hi all:

           I have a question about flex submenu. First I will show my code here, then describe the problem:

      <?xml version="1.0"?>
      <!-- Simple example to demonstrate the MenuBar control. -->
      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
      creationComplete="initCollections();">


          <mx:Script>
              <![CDATA[
               import mx.controls.menuClasses.IMenuItemRenderer;
               import mx.controls.listClasses.IListItemRenderer;
               import mx.controls.Menu;
                  import mx.events.MenuEvent;
                  import mx.controls.Alert;
                  import mx.collections.*;

                  [Bindable]
                  public var menuBarCollection:XMLListCollection;

                  private var menubarXML:XMLList =
                      <>
                          <menuitem label="Menu1" data="1">
                              <menuitem label="MenuItem 1-A" data="1A"/>
                              <menuitem label="MenuItem 1-B" data="1B"/>
                          </menuitem>
                          <menuitem label="Menu2" data="2">

                              <menuitem label="MenuItem 2-B" >
                                  <menuitem label="SubMenuItem 3-A" type="radio"
                                      groupName="one" data="3A"/>
                                  <menuitem label="SubMenuItem 3-B" type="radio"
                                      groupName="one" data="3B"/>
                              </menuitem>
                              <menuitem type="separator"/>
                              <menuitem label="MenuItem 2-A" type="check" data="2A"/>

                          </menuitem>
                          <menuitem label="Menu3" data="3">
                          </menuitem>
                      </>;


                  // Event handler to initialize the MenuBar control.
                  private function initCollections():void {
                      menuBarCollection = new XMLListCollection(menubarXML);
                  }
               ]]>
          </mx:Script>


          <mx:Panel title="MenuBar Control Example" height="75%" width="75%"
              paddingTop="10" paddingLeft="10">
              <mx:Label width="100%" color="blue"
                 text="Select a menu item."/>
              <mx:MenuBar labelField="@label" showRoot="true"
                  dataProvider="{menuBarCollection}" />
          </mx:Panel>
      </mx:Application>

      The problem is:

      Click Menu2 on the main menu bar, this displays the pull-down sub-menus of MenuItem 2-B, separator and MenuItem 2-A.
      Move mouse to hover over MenuItem 2-B - sub-menu displays showing SubMenuItem 3-A, SubMenuItem 3-B.

      Next, slide mouse back up to main menu Menu2 , then back down to MenuItem 2-B. This time the sub-menu dosen't display(I want to know why this happend and how to resolve it).
      If you slide the mouse down to MenuItem 2-A then back up to MenuItem 2-B, then the sub-menus will be displayed.

      Looking for your reply, thank you.