0 Replies Latest reply on Jan 19, 2014 6:55 PM by Sasano

    How to avoid MenuBar skipping some submenu hierarchy while opening menu?

    Sasano

      Hello here is my code and the result for different cases.
      I observed the same result for Flex3 and Flex4.

       

      It seems that when you have MenuItems nested as follows,
            - MenuItem a is in the MenuBar.
            - MenuItem b is in the submenu of a (let's call "submenu A").
            - No other MenuItem exists in submenu A.
            - MenuItem c is in the submenu of b (let's call "submenu B").
            - No other MenuItem exists in submenu B.
            - and so on..
      1 in every 2 menu don't appear. (In this case, submenu A,C,E,G,... don't show.)

       

      May anyone know the reason or how to fix it?

       

      Sample code:

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

      <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"

                     initialize="init()" xmlns:local="*">

          <mx:Script>

              <![CDATA[

                  import mx.collections.XMLListCollection;

       

       

                  [Bindable]

                  public var menuBarCollection:XMLListCollection;

                  private var menubarXML:XMLList =

                      <>

                      <menuitem label="Menu1" data="1">

                          <menuitem label="MenuItem 11" data="11"/>

                          <menuitem label="MenuItem 12" data="12">

                              <menuitem label="MenuItem 121" data="121">

                                  <menuitem label="MenuItem 1211" data="1211"/>

                              </menuitem>

                              <menuitem label="MenuItem 122" data="122">

                                  <menuitem label="MenuItem 1221" data="1221">

                                      <menuitem label="MenuItem 12211" data="12211"/>

                                  </menuitem>

                              </menuitem>

                              <menuitem label="MenuItem 123" data="123">

                                  <menuitem label="MenuItem 1231" data="1231">

                                      <menuitem label="MenuItem 12311" data="12311">

                                          <menuitem label="MenuItem 123111" data="123111"/>

                                      </menuitem>

                                  </menuitem>

                              </menuitem>

                              <menuitem label="MenuItem 124" data="124">

                                  <menuitem label="MenuItem 1241" data="1241">

                                      <menuitem label="MenuItem 12411" data="12411"/>

                                      <menuitem label="MenuItem 12412" data="12412"/>

                                  </menuitem>

                              </menuitem>

                          </menuitem>

                          <menuitem label="MenuItem 13" data="13"/>

                      </menuitem>

                      <menuitem label="Menu2" data="2">

                          <menuitem label="Menu2-1" data="2-1">

                              <menuitem label="Menu2-2" data="2-2">

                                  <menuitem label="Menu2-3" data="2-3">

                                      <menuitem label="Menu2-4" data="2-4">

                                          <menuitem label="Menu2-5" data="2-5">

                                              <menuitem label="Menu2-6" data="2-6">

                                                  <menuitem label="Menu2-7" data="2-7">

                                                      <menuitem label="Menu2-8" data="2-8">

                                                          <menuitem label="Menu2-9" data="2-9">

                                                              <menuitem label="Menu2-10" data="2-10">

                                                              </menuitem>

                                                          </menuitem>

                                                      </menuitem>

                                                  </menuitem>

                                              </menuitem>

                                          </menuitem>

                                      </menuitem>

                                   </menuitem>

                               </menuitem>

                           </menuitem>

                      </menuitem>

                      </>;

       

       

                  private function init():void {

                      menuBarCollection = new XMLListCollection(menubarXML);

                  }

              ]]>

          </mx:Script>

                <mx:MenuBar width="100%" dataProvider="{menuBarCollection}" labelField="@label"/>

      </mx:Application>

       

       

      Result: in this case, the following items don't appear.
      1221,1231,1241,2-2,2-4,2-6,2-8