flex之Button,ButtonBar,LinkButton,LinkBar,ToggleButtonBar

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
			   xmlns:s="library://ns.adobe.com/flex/spark" 
			   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600">
	<fx:Declarations>
		<!-- 将非可视元素(例如服务、值对象)放在此处 -->
	</fx:Declarations>
	<fx:Script>
		<![CDATA[
			import mx.collections.ArrayCollection;
			import mx.controls.Alert;
			public var myArray:ArrayCollection = new ArrayCollection(['One','Two','Three']);
			public function showMsg(msg:String):void
			{
			Alert.show('you just click on ' + msg);
			}
		]]>
	</fx:Script>
	
	<s:Panel title="Profile" width="360" height="240" horizontalCenter="0" verticalCenter="0">
		<s:layout>
			<s:HorizontalLayout/>
		</s:layout>
		<s:VGroup>
			<s:Button id="thisBtn" label="Button" click="showMsg('button')"/>
			<mx:LinkButton id="thisLinkBtn" label="Linkbutton" click="showMsg('linkbutton')"/>
		</s:VGroup>
		
		<s:VGroup>
			<s:ButtonBar id="thisBtnBar" dataProvider="{myArray}"
						 click="showMsg(ButtonBar(event.currentTarget).selectedItem)"
						 />
			<mx:LinkBar id="thisLinkBar"
						dataProvider="{myArray}"
						itemClick="showMsg(event.label)"/>
			<mx:ToggleButtonBar id="thisToggleBar"
								dataProvider="{myArray}"
								itemClick="showMsg(event.label)"/>
		</s:VGroup>
	</s:Panel>
</s:Application>

你可能感兴趣的:(flex按钮)