0 Replies Latest reply on Apr 13, 2008 11:44 PM by paulhergh

    Reading values from menubar dataProvider for "top" menu items

    paulhergh
      I have a XML file that looks like this:

      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <root>
      <menuitem label="Home" value="2" />
      <menuitem label="top1" value="3" />
      <menuitem label="top2" value="4" />
      <menuitem label="top3" value="5">
      <menuitem label="subMenu1" value="9" />
      <menuitem label="subMenu2" value="10" />
      <menuitem label="subMenu3" value="11" />
      <menuitem label="subMenu4" value="12" />
      <menuitem label="subMenu5" value="13" />
      <menuitem label="subMenu6" value="14" />
      </menuitem>
      </root>

      There are 3 "top" menuitems, home, top1, top2. I am handling them using a click function from a mouseEvent:

      mx:MenuBar
      id="myMenuBar"
      click="clickMenuHandler(event)"
      itemClick="mesaj(event)"
      showRoot="false"
      labelField="@label" />

      The question is how can I retrieve the value data for theese 3 "top" menus, so when I click on the "home" the value 2 should be returned.

      I have tried something like this, but it returns the index of the menu that was currently clicked

      public function clickMenuHandler(event:MouseEvent):void {
      var selectedItem:String = myMenuBar.selectedIndex.toString();
      }