carly31
2/2/2016 - 6:01 AM

Button

<?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">

	<!-- define a counter variable to be incremented -->
	<fx:Declarations>
		<fx:Number id="counter">0</fx:Number>
	</fx:Declarations>

	<!-- buttons organized into a VGroup which is then placed in a HGroup next
	to the label -->
	<s:HGroup horizontalCenter="0" verticalCenter="0" verticalAlign="middle">
		<s:VGroup>
			<!-- increment counter on the buttonDown action. can autorepeat and
			disable buttons. -->
			<s:Button id="btn1" label="Click Once" buttonDown="counter++;" />
			<s:Button id="btn2" label="Click and Hold" autoRepeat="true" buttonDown="counter++;" />
			<s:Button id="btn3" label="Disabled" enabled="false" buttonDown="counter++" />
		</s:VGroup>
		<s:Spacer width="50" />
		<s:Label text="{counter}" />
	</s:HGroup>
</s:Application>