carly31
2/2/2016 - 6:00 AM

radiobuttongroup

<?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">
	<fx:Declarations>
		<s:RadioButtonGroup id="rdio" itemClick="handleRadioClick(event);" />
	</fx:Declarations>
	
	<!-- bind the textColor to the RadioButtons so that every time the function
	updates the color, it will change the color of the text -->
	<fx:Script>
		<![CDATA[
			import mx.events.ItemClickEvent;
			
			[Bindable]
			private var textColor:uint = 0x000000;
			
			private function handleRadioClick(event:ItemClickEvent):void {
				textColor = event.currentTarget.selectedValue;
			}
		]]>
	</fx:Script>
	
	<s:VGroup horizontalCenter="0" verticalCenter="0">
		<s:RadioButton groupName="rdio" id="red" value="0xFF0000" label="Red" color="{textColor}" />
		<s:RadioButton groupName="rdio" id="green" value="0x00FF00" label="Green" color="{textColor}" />
		<s:RadioButton groupName="rdio" id="blue" value="0x0000FF" label="Blue" color="{textColor}" />
	</s:VGroup>
	
</s:Application>