5 Replies Latest reply on Sep 6, 2010 9:16 PM by Subeesh Arakkan

    Subptions in Menubar

    edwinmerced Level 1

      I have this menu bar...Ican access the tops menu options but do not know how to access submenu options. Any help Thanks

       


      This is the access:

       

      <![CDATA[
                  import mx.controls.Alert;
                  import mx.controls.menuClasses.MenuBarItem;
                 
                  protected function init():void {
                      var mb:MenuBarItem = mBar.menuBarItems[0] as MenuBarItem;
                      var mb1:MenuBarItem = mBar.menuBarItems[3] as MenuBarItem;
                      mb.addEventListener(MouseEvent.CLICK, u1m1_click);
                      mb1.addEventListener(MouseEvent.CLICK, u1m2_click);
                  }
                 
                  protected function u1m1_click(evt:MouseEvent):void {
                      //Alert.show("You clicked the first menu bar item.");
                      currentState='u1m1';
                     
                  }
                  protected function u1m2_click(evt:MouseEvent):void {
                      //Alert.show("You clicked the second menu bar item.");
                      currentState='u1m2';
                  }
              ]]>

       

      This is the menubar:

       

      <mx:MenuBar id="mBar" labelField="@label" creationComplete="init();" left="51" width="375" horizontalCenter="-242" y="44.35">
              <mx:dataProvider>
                  <s:XMLListCollection>
                      <fx:XMLList xmlns="">
                          <menu label="Home" />
                          <menu label="Unit 1...">
                              <item label="Module 1.1" toggled="true"/>
                              <item label="Module 1.2" toggled="true"/>
                              <item label="Module 1.3" toggled="true"/>
                              <item label="Module 1.4" toggled="true"/>
                          </menu>
                          <menu label="Unit 2...">
                              <item label="Module 2.1"  toggled="true"/>
                              <item label="Module 2.2"  toggled="true"/>
                              <item label="Module 2.3"  toggled="true"/>
                              <item label="Module 2.4"  toggled="true"/>
                          </menu>
                          <menu label="Unit 3...">
                              <item label="Module 3.1" toggled="true"/>
                              <item label="Module 3.2" toggled="true"/>
                              <item label="Module 3.3" toggled="true"/>
                              <item label="Module 3.4" toggled="true"/>
                          </menu>
                          <menu label="Resources...">
                              <item label="Readings" />
                              <item label="Websites" />
                              <item label="Applications" />
                              <item label="Exercises" />
                              <item label="Worksheets" />
                              <item label="Evaluations" />
                          </menu>
         
                      </fx:XMLList>
                  </s:XMLListCollection>
              </mx:dataProvider>
          </mx:MenuBar>