来源:http://www.cuplayer.com/player/PlayerCode/Flex/2013/0118661.html
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.MenuEvent;
protected function menubar1_itemClickHandler(event:MenuEvent):void
{
Alert.show([email protected]);
}
]]>
</fx:Script>
<mx:MenuBar x="118" y="124" labelField="@label" itemClick="menubar1_itemClickHandler(event)">
<mx:dataProvider>
<mx:XMLListCollection>
<fx:XMLList xmlns="">
<menu label="aa">
<item label="aa1" />
<item label="aa2" />
</menu>
<menu label="bb">
<item label="bb1" />
<item label="bb2" />
</menu>
</fx:XMLList>
</mx:XMLListCollection>
</mx:dataProvider>
</mx:MenuBar>
经测试可用。。。。转载请标明原文出处。。