2 Replies Latest reply on Jan 27, 2010 9:07 AM by shashank543233

    How to use navigateTourl for menuBars submenus? plzz help

    shashank543233 Level 1

      pllzz someone tell me how to use navigateTourl for submenus!!plzz

        • 1. Re: How to use navigateTourl for menuBars submenus? plzz help
          Stefan Horochovec

          Hello


          Well, let's go!

           

          In this code, you have your menuBar

           

          <mx:MenuBar labelField="@label" itemClick="menuHandler(event);" dataProvider="{menuBarCollection}" />

           

          I add on MenuBar a function for itemClick event, and in my dataProvider i set the menuBarCollection.

           

          private var menubarXML:XMLList =

                          <>

                              <menuitem label="Menu" data="top">

                                  <menuitem label="Adobe" data="http://www.adobe.com/"/>

                                  <menuitem label="Adobe Labs" data="http://labs.adobe.com/"/>

                              </menuitem>

                          </>;

           

          And i transform this menubarXML to a XMLListCollection on a function

           

          private function initMenuBar() : void {

               this.menuBarCollection = new XMLListCollection(menubarXML);

          }

           

          Well... in my itemClick event on menuBar:

           

           

          private function menuHandler(event:MenuEvent):void  {

               if (event.item.@data != "top") {

                    var objURLReq:URLRequest = new URLRequest(event.item.@data.toString());

                    navigateToURL(objURLReq, "_blank");

               }       

          }

           

          Well, this is it. You have a menuBar with navigateToURL on itemClick on menu.

           

          Regards

          • 2. Re: How to use navigateTourl for menuBars submenus? plzz help
            shashank543233 Level 1

            hey when i try to export the file and open the .html file..the links i have assigned to the sub menus are not working...how to solve it