itemRollOver event for MenuBar
<?xml version="1.0"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="initCollections();"> <mx:Script> import mx.events.MenuEvent; import mx.controls.Alert; import mx.collections.*; [Bindable] public var menuBarCollection:XMLListCollection; private var menubarXML:XMLList =<><menuitem label="Menu1"> <menuitem label="MenuItem 1-A" data="1A"/> <menuitem label="MenuItem 1-B" data="1B"/> </menuitem> <menuitem label="Menu2"> <menuitem label="MenuItem 2-A" data="2A"/> <menuitem label="MenuItem 2-B" data="2B"/> </menuitem> <menuitem label="Menu3" data="M3"/> </> private function initCollections():void { menuBarCollection = new XMLListCollection(menubarXML); } private function rollOverHandler(event:MenuEvent):void { rollOverTextArea.text = "type: " + event.type + "\n"; rollOverTextArea.text += "target menuBarIndex: " +event.index + "\n"; } </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" dataProvider="{menuBarCollection}" itemRollOver="rollOverHandler(event);"/> <mx:TextArea id="rollOverTextArea" width="200" height="100" /> <mx:TextArea id="itemClickTextArea" width="200" height="100" /> </mx:Panel> </mx:Application>