1 Reply Latest reply on Sep 11, 2009 8:24 AM by babo_ya

    Menubar root

    markuspedro Level 1

      May I set a property to see only menubar root and not the submenu?

       

      thank you

        • 1. Re: Menubar root
          babo_ya Level 3

          Don't really understand your question..

           

          if you don't want to see the submenus maybe just don't add them... but, if you want to hide/show submenus...

           

          try this..

           

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

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

                  layout="vertical"

                  verticalAlign="left"

                  backgroundColor="white"

                  creationComplete="init();"

          >

           

              <mx:Script>

              <![CDATA[

           

           

              private function init():void

              {

             

           

              }

              private function showBtn(event:MouseEvent):void

              {

              myMenuBar.dataProvider = d;

              }

              private function hideBtn(event:MouseEvent):void

              {

              myMenuBar.dataProvider = null;

              }

           

              ]]>

              </mx:Script>

           

          <mx:XMLList id="d">

                      <menuitem label="MenuItem A">

                          <menuitem label="SubMenuItem A-1" enabled="false"/>

                          <menuitem label="SubMenuItem A-2"/>

                      </menuitem>

                      <menuitem label="MenuItem B"/>

                      <menuitem label="MenuItem C"/>

                      <menuitem label="MenuItem D">

                          <menuitem label="SubMenuItem D-1"

                              type="radio" groupName="one"/>

                          <menuitem label="SubMenuItem D-2"

                              type="radio" groupName="one"

                              selected="true"/>

                          <menuitem label="SubMenuItem D-3"

                              type="radio" groupName="one"/>

                      </menuitem>

                  </mx:XMLList>

           

          <mx:Button label="show" click="showBtn(event);" />

          <mx:Button label="hide" click="hideBtn(event);" />

           

           

          <mx:MenuBar id="myMenuBar" labelField="@label">

           

              </mx:MenuBar>

           

          </mx:Application>

           

           

          Maybe there is a better way to do this...

           

          hope this helps,

           

          BaBo,