Using examples from http://livedocs.adobe.com/flex/3/langref/mx/controls/MenuBar.html#includ\ eExamplesSummary and http://blog.flexexamples.com/2007/08/18/displaying-icons-in-a-flex-combo\ box-control/ I came up with the following example:
<?xml version="1.0"?> <!-- Simple example to demonstrate the MenuBar control. --> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initCollections();" > <mx:Script> <![CDATA[ import mx.events.MenuEvent; import mx.controls.Alert; import mx.collections.*; [Bindable] public var menuBarCollection:XMLListCollection; [Bindable] [Embed(source="assets/bulletCheck.png")] public var BulletCheck:Class; [Bindable] [Embed(source="assets/bulletWarning.png")] public var BulletWarning:Class; [Bindable] [Embed(source="assets/bulletCritical.png")] public var BulletCritical:Class; private var menubarXML:XMLList = <> <menuitem label="Menu1" data="top"> <menuitem label="MenuItem 1-A" data="1A" icon="BulletWarning"/> <menuitem label="MenuItem 1-B" data="1B" icon="BulletCheck"/> </menuitem> <menuitem label="Menu2" data="top"> <menuitem label="MenuItem 2-A" type="check" data="2A" icon="BulletWarning"/> <menuitem type="separator"/> <menuitem label="MenuItem 2-B" icon="BulletCritical"> <menuitem label="SubMenuItem 3-A" type="radio" groupName="one" data="3A" icon="BulletCritical"/> <menuitem label="SubMenuItem 3-B" type="radio" groupName="one" data="3B" icon="BulletCheck"/> </menuitem> </menuitem> </>; // Event handler to initialize the MenuBar control. private function initCollections():void { menuBarCollection = new XMLListCollection(menubarXML); } // Event handler for the MenuBar control's itemClick event. private function menuHandler(event:MenuEvent):void { // Don't open the Alert for a menu bar item that // opens a popup submenu. if (event.it...@data != "top") { Alert.show("Label: " + event.it...@label + "\n" + "Data: " + event.it...@data, "Clicked menu item"); } } ]]> </mx:Script> <mx:Panel title="MenuBar Control Example" height="75%" width="75%" paddingTop="10" paddingLeft="10"> <mx:Label width="100%" color="blue" text="Select a menu item."/> <mx:MenuBar labelField="@label" iconField="@icon" itemClick="menuHandler(event);" dataProvider="{menuBarCollection}" /> </mx:Panel> </mx:Application> HTH Steve --- In flexcoders@yahoogroups.com, "grg_blls" <grg_b...@...> wrote: > > Excuse me guys for dropping in to ask, but as to the first post: The second part of the code is about a menuBar control showing icons - though the post is titled "how to show icon in ToggleButtonBar". > As I have a same problem with a menuBar here trying to show some icons along with the labels, I gave it a try and no icons appear also here. BTW it doesn't throw any error. > (My dataProvider is also a XMLList, with more subMenus, but same in concept to your example). > So what's going on? > > Thanks > George > > --- In flexcoders@yahoogroups.com, "nathanleewei" nathanleewei@ wrote: > > > > Are icons shown in ToggleButtonBar? > > > > What's your flex sdk version? > > > > > > --- In flexcoders@yahoogroups.com, "valdhor" <valdhorlists@> wrote: > > > > > > Works for me. Do you get any errors? > > >