3 Replies Latest reply on Jun 6, 2007 8:57 AM by Neburnz@1981

    MenuBar Icons

    IamJosh
      I am unable to put icons in my menubar.

      here's the code ive been testing it with
      'xml
      private var menubarXML:XMLList =
      <>
      <menuitem label="Menu1" icon="greenarrowdown.png">
      <menuitem label="MenuItem 1-A" data="1A" icon="/images/printer.png)"/>
      <menuitem label="MenuItem 1-B" data="1B" icon="greenarrowdown.png"/>

      </menuitem>
      <menuitem label="Menu2" icon="enlarge_symbol_mc.swf">
      <menuitem icon="enlarge_symbol_mc.swf" label="MenuItem 2-A" type="check" data="2A"/>
      <menuitem type="separator" />
      <menuitem label="MenuItem 2-B" >
      <menuitem label="SubMenuItem 3-A" type="radio"
      groupName="one" data="3A"/>
      <menuitem label="SubMenuItem 3-B" type="radio"
      groupName="one" data="3B"/>
      </menuitem>
      </menuitem>
      </>;


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


      can anyone tell me what im doing wrong?
        • 1. Re: MenuBar Icons
          IamJosh Level 1
          Does anyone have any idea's on how to get icons in the menubar?
          • 2. Re: MenuBar Icons
            batmitra Level 1
            hi
            i've never worked with menubar before but looking at your code ,you are passing a dataprovider called menubarcollection when you are giving you xml menubar source a name of menubarXML, maybe that's the problem.
            • 3. Re: MenuBar Icons
              Neburnz@1981
              Ummm.. In my experience I used a XML object, but the icons are public bindable vars with type Class, in icon attribute in XML enter the icon class Id.

              Example:

              <mx:Script>
              <![CDATA[

              [Bindable]
              [Embed(source='you icon file...')]
              public var myIcon : Class;
              </mx:Script>
              <mx:XML id="myMenuData" format="e4x">
              <root>
              <menuItem label="Home" data="0" icon="myIcon"/>
              <menuItem label="MenuItem1" data="1" icon="myIcon"/>
              </root>
              </mx:XML>
              <mx:MenuBar id="myMenu" dataProvider="{this.myMenuData}" labelField="@label" showRoot="false" iconField="@icon"/>

              OK, check if everything run fine...
              Note: The nested subMenuItem don't show the icons...X(