// 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.item.@data != "top") { Alert.show("Label: " + event.item.@label + "\n" + "Data: " + event.item.@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."/>