<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
import mx.events.ItemClickEvent;
private function clickHandler(event:ItemClickEvent):void{
myTA.text = "所选 按钮:" + event.label;
}
]]>
</mx:Script>
<mx:Style source="style.css"/>
<mx:Panel title="按钮条 ButtonBar 示例" height="50%" width="50%"
paddingTop="10" paddingBottom="10" paddingLeft="10" paddingRight="10">
<mx:Label width="100%" color="blue"
text="选择 按钮 在文本区域 得到 相应值。"/>
<mx:TextArea id="myTA" width="100%" height="100%"/>
<mx:ButtonBar horizontalGap="5" itemClick="clickHandler(event);">
<mx:dataProvider>
<mx:Array>
<mx:String>按钮 A</mx:String>
<mx:String>按钮 B</mx:String>
<mx:String>按钮 C</mx:String>
<mx:String>按钮 D</mx:String>
<mx:String>按钮 E</mx:String>
</mx:Array>
</mx:dataProvider>
</mx:ButtonBar>
</mx:Panel>
</mx:Application>
[img]/upload/attachment/115903/c1b69da6-9362-36ec-836c-491c05a52e38.png[/img]
按钮条 示例