<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Flex Examples &#187; RadioButtonGroup</title>
	<atom:link href="http://blog.flexexamples.com/category/halo/radiobuttongroup/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flexexamples.com</link>
	<description>Just a bunch of Adobe Flex Examples</description>
	<lastBuildDate>Wed, 26 Jan 2011 18:09:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Detecting when the number of radio buttons changes in a radio button group in Flex</title>
		<link>http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 03:56:55 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[numRadioButtonsChanged]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when the number of RadioButton objects changes in a RadioButtonGroup in Flex by listening for the numRadioButtonsChanged event.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white" initialize="init();"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; private function init():void [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when the number of RadioButton objects changes in a RadioButtonGroup in Flex by listening for the <code>numRadioButtonsChanged</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-679"></span></p>
<p class="download"><a href="">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;

            private function init():void {
                radioGroup.addEventListener("numRadioButtonsChanged", radioGroup_numRadioButtonsChanged);
            }

            private function radioGroup_numRadioButtonsChanged(evt:Event):void {
                var rb:RadioButton = radioGroup.getRadioButtonAt(radioGroup.numRadioButtons-1);
                var alert:Alert = Alert.show(evt.toString(), "label:" + rb.label);
                alert.status = "numRadioButtons:" + radioGroup.numRadioButtons;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:RadioButtonGroup id="radioGroup" /&gt;

    &lt;mx:HBox&gt;
        &lt;mx:RadioButton id="radioButton1" label="Red" group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton2" label="Orange" group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton3" label="Yellow" group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton4" label="Green" group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton5" label="Blue" group="{radioGroup}" /&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when the number of radio buttons changes in a radio button group in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/',contentID: 'post-679',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'numRadioButtonsChanged',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/11/10/detecting-when-the-number-of-radio-buttons-changes-in-a-radio-button-group-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Detecting when a RadioButtonGroup has been enabled or disabled in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/#comments</comments>
		<pubDate>Wed, 25 Jun 2008 15:03:42 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[enabled]]></category>
		<category><![CDATA[enabledChanged]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/</guid>
		<description><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/">&#8220;Enabling and disabling RadioButton controls in a RadioButtonGroup in Flex&#8221;</a>, we saw how you can enable or disable all of the RadioButton controls in a Flex RadioButtonGroup by setting the enabled property.</p> <p>The following example shows how you can detect when the enabled property changes by using the enabledChanged event.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous example, <a href="http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/">&#8220;Enabling and disabling RadioButton controls in a RadioButtonGroup in Flex&#8221;</a>, we saw how you can enable or disable all of the RadioButton controls in a Flex RadioButtonGroup by setting the <code>enabled</code> property.</p>
<p>The following example shows how you can detect when the enabled property changes by using the <code>enabledChanged</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-680"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabledChanged_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;

            private function init():void {
                radioGroup.addEventListener("enabledChanged",
                            radioGroup_enabledChanged);
            }

            private function radioGroup_enabledChanged(evt:Event):void {
                Alert.show("RadioButtonGroup enabled was changed",
                            "enabled: " + radioGroup.enabled);
            }

            private function checkBox_change(evt:Event):void {
                radioGroup.enabled = !radioGroup.enabled;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="enabled:"&gt;
                &lt;mx:CheckBox id="checkBox"
                        selected="true"
                        change="checkBox_change(event);" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id="radioGroup" /&gt;

    &lt;mx:HBox horizontalGap="54"&gt;
        &lt;mx:RadioButton id="radioButton1"
                label="Red"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton2"
                label="Orange"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton3"
                label="Yellow"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton4"
                label="Green"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton5"
                label="Blue"
                group="{radioGroup}" /&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabledChanged_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabledChanged_test/bin/main.html" width="100%" height="250"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabledChanged_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.containers.HBox;
            import mx.controls.Alert;
            import mx.controls.CheckBox;
            import mx.controls.RadioButton;
            import mx.controls.RadioButtonGroup;

            private var checkBox:CheckBox;
            private var radioGroup:RadioButtonGroup;
            private var radioButton1:RadioButton;
            private var radioButton2:RadioButton;
            private var radioButton3:RadioButton;
            private var radioButton4:RadioButton;
            private var radioButton5:RadioButton;

            private function init():void {
                checkBox = new CheckBox();
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                var formItem:FormItem = new FormItem();
                formItem.label = "enabled:";
                formItem.addChild(checkBox);

                var form:Form = new Form();
                form.styleName = "plain";
                form.addChild(formItem);

                var appControlBar:ApplicationControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                Application.application.addChildAt(appControlBar, 0);

                radioGroup = new RadioButtonGroup();
                radioGroup.addEventListener("enabledChanged", radioGroup_enabledChanged);

                radioButton1 = new RadioButton();
                radioButton1.label = "Red";
                radioButton1.group = radioGroup;

                radioButton2 = new RadioButton();
                radioButton2.label = "Orange";
                radioButton2.group = radioGroup;

                radioButton3 = new RadioButton();
                radioButton3.label = "Yellow";
                radioButton3.group = radioGroup;

                radioButton4 = new RadioButton();
                radioButton4.label = "Green";
                radioButton4.group = radioGroup;

                radioButton5 = new RadioButton();
                radioButton5.label = "Blue";
                radioButton5.group = radioGroup;

                var hBox:HBox = new HBox();
                hBox.setStyle("horizontalGap", 54);
                hBox.addChild(radioButton1);
                hBox.addChild(radioButton2);
                hBox.addChild(radioButton3);
                hBox.addChild(radioButton4);
                hBox.addChild(radioButton5);
                addChild(hBox);
            }

            private function radioGroup_enabledChanged(evt:Event):void {
                Alert.show("RadioButtonGroup enabled was changed",
                            "enabled: " + radioGroup.enabled);
            }

            private function checkBox_change(evt:Event):void {
                radioGroup.enabled = !radioGroup.enabled;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when a RadioButtonGroup has been enabled or disabled in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/',contentID: 'post-680',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'enabled,enabledChanged',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/25/detecting-when-a-radiobuttongroup-has-been-enabled-or-disabled-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disabling keyboard navigation on the RadioButton control in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 03:07:19 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[KeyboardEvent]]></category>
		<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[keyDownHandler()]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can disable keyboard navigation within a Flex RadioButton/RadioButtonGroup by extending the RadioButton class and overriding the protected keyDownHandler() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns:comps="comps.*" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:RadioButtonGroup id="radioGroup1" /&#62; &#60;mx:RadioButtonGroup id="radioGroup2" /&#62; &#60;mx:Form&#62; &#60;mx:FormItem [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can disable keyboard navigation within a Flex RadioButton/RadioButtonGroup by extending the RadioButton class and overriding the protected <code>keyDownHandler()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-681"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        xmlns:comps="comps.*"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:RadioButtonGroup id="radioGroup1" /&gt;
    &lt;mx:RadioButtonGroup id="radioGroup2" /&gt;

    &lt;mx:Form&gt;
        &lt;mx:FormItem label="keyboard enabled:"
                direction="horizontal"&gt;
            &lt;mx:RadioButton id="radioButton1"
                    label="Red"
                    group="{radioGroup1}" /&gt;
            &lt;mx:RadioButton id="radioButton2"
                    label="Orange"
                    group="{radioGroup1}" /&gt;
            &lt;mx:RadioButton id="radioButton3"
                    label="Yellow"
                    group="{radioGroup1}" /&gt;
            &lt;mx:RadioButton id="radioButton4"
                    label="Green"
                    group="{radioGroup1}" /&gt;
            &lt;mx:RadioButton id="radioButton5"
                    label="Blue"
                    group="{radioGroup1}" /&gt;
        &lt;/mx:FormItem&gt;
        &lt;mx:FormItem label="keyboard disabled:"
                direction="horizontal"&gt;
            &lt;comps:MyRadioButton id="radioButton6"
                    label="Red"
                    group="{radioGroup2}" /&gt;
            &lt;comps:MyRadioButton id="radioButton7"
                    label="Orange"
                    group="{radioGroup2}" /&gt;
            &lt;comps:MyRadioButton id="radioButton8"
                    label="Yellow"
                    group="{radioGroup2}" /&gt;
            &lt;comps:MyRadioButton id="radioButton9"
                    label="Green"
                    group="{radioGroup2}" /&gt;
            &lt;comps:MyRadioButton id="radioButton0"
                    label="Blue"
                    group="{radioGroup2}" /&gt;
        &lt;/mx:FormItem&gt;
    &lt;/mx:Form&gt;

&lt;/mx:Application&gt;
</pre>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/source/comps/MyRadioButton.as.html">comps/MyRadioButton.as</a></p>
<pre class="code">
/**
 * http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/
 */
package comps {
    import flash.events.KeyboardEvent;
    import mx.controls.RadioButton;

    public class MyRadioButton extends RadioButton {
        public function MyRadioButton() {
            super();
        }

        override protected function keyDownHandler(event:KeyboardEvent):void {
            // ignore
        }
    }
}
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also override the <code>keyDownHandler()</code> method using a custom MXML component, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/source/comps/MyRadioButton2.mxml.html">comps/MyRadioButton2.mxml</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/ --&gt;
&lt;mx:RadioButton xmlns:mx="http://www.adobe.com/2006/mxml"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            override protected function keyDownHandler(event:KeyboardEvent):void {
                // ignore
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:RadioButton&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_keyDownHandler_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import comps.*;

            import mx.containers.FormItemDirection;
            import mx.containers.FormItem;
            import mx.containers.Form;
            import mx.controls.RadioButton;
            import mx.controls.RadioButtonGroup;

            private var radioGroup1:RadioButtonGroup;
            private var radioGroup2:RadioButtonGroup;

            private var radioButton1:RadioButton;
            private var radioButton2:RadioButton;
            private var radioButton3:RadioButton;
            private var radioButton4:RadioButton;
            private var radioButton5:RadioButton;

            private var radioButton6:MyRadioButton;
            private var radioButton7:MyRadioButton;
            private var radioButton8:MyRadioButton;
            private var radioButton9:MyRadioButton;
            private var radioButton0:MyRadioButton;

            private function init():void {
                radioGroup1 = new RadioButtonGroup();
                radioGroup2 = new RadioButtonGroup();

                // 1
                radioButton1 = new RadioButton();
                radioButton1.label = "Red";
                radioButton1.group = radioGroup1;
                // 2
                radioButton2 = new RadioButton();
                radioButton2.label = "Orange";
                radioButton2.group = radioGroup1;
                // 3
                radioButton3 = new RadioButton();
                radioButton3.label = "Yellow";
                radioButton3.group = radioGroup1;
                // 4
                radioButton4 = new RadioButton();
                radioButton4.label = "Green";
                radioButton4.group = radioGroup1;
                // 5
                radioButton5 = new RadioButton();
                radioButton5.label = "Blue";
                radioButton5.group = radioGroup1;

                // 6
                radioButton6 = new MyRadioButton();
                radioButton6.label = "Red";
                radioButton6.group = radioGroup2;
                // 7
                radioButton7 = new MyRadioButton();
                radioButton7.label = "Orange";
                radioButton7.group = radioGroup2;
                // 8
                radioButton8 = new MyRadioButton();
                radioButton8.label = "Yellow";
                radioButton8.group = radioGroup2;
                // 9
                radioButton9 = new MyRadioButton();
                radioButton9.label = "Green";
                radioButton9.group = radioGroup2;
                // 0
                radioButton0 = new MyRadioButton();
                radioButton0.label = "Blue";
                radioButton0.group = radioGroup2;

                var formItem1:FormItem = new FormItem();
                formItem1.label = "keyboard enabled:";
                formItem1.direction = FormItemDirection.HORIZONTAL;
                formItem1.addChild(radioButton1);
                formItem1.addChild(radioButton2);
                formItem1.addChild(radioButton3);
                formItem1.addChild(radioButton4);
                formItem1.addChild(radioButton5);

                var formItem2:FormItem = new FormItem();
                formItem2.label = "keyboard disabled:";
                formItem2.direction = FormItemDirection.HORIZONTAL;
                formItem2.addChild(radioButton6);
                formItem2.addChild(radioButton7);
                formItem2.addChild(radioButton8);
                formItem2.addChild(radioButton9);
                formItem2.addChild(radioButton0);

                var form:Form = new Form();
                form.addChild(formItem1);
                form.addChild(formItem2);
                addChild(form);
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Disabling keyboard navigation on the RadioButton control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/',contentID: 'post-681',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'keyDownHandler()',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/23/disabling-keyboard-navigation-on-the-radiobutton-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Detecting when a RadioButton has been clicked in a RadioButtonGroup in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 01:52:05 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[itemClick]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can detect when a RadioButton has been clicked in a FlexRadioButtonGroup by listening for the itemClick event.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_itemClick_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.events.ItemClickEvent; private function radioGroup_itemClick(evt:ItemClickEvent):void { var now:String = [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can detect when a RadioButton has been clicked in a FlexRadioButtonGroup by listening for the <code>itemClick</code> event.</p>
<p>Full code after the jump.</p>
<p><span id="more-678"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_itemClick_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ItemClickEvent;

            private function radioGroup_itemClick(evt:ItemClickEvent):void {
                var now:String = new Date().toTimeString();
                lbl.text = evt.label + " (" + now + ")";
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Label id="lbl" fontWeight="bold" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id="radioGroup"
            itemClick="radioGroup_itemClick(event);" /&gt;

    &lt;mx:VBox&gt;
        &lt;mx:RadioButton id="radioButton1"
                label="Red"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton2"
                label="Orange"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton3"
                label="Yellow"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton4"
                label="Green"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton5"
                label="Blue"
                group="{radioGroup}" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_itemClick_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_itemClick_test/bin/main.html" width="100%" height="250"></iframe></p>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_itemClick_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        initialize="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.VBox;
            import mx.containers.ApplicationControlBar;
            import mx.controls.Label;
            import mx.controls.RadioButton;
            import mx.controls.RadioButtonGroup;
            import mx.events.ItemClickEvent;

            private var lbl:Label;
            private var radioGroup:RadioButtonGroup;
            private var radioButton1:RadioButton;
            private var radioButton2:RadioButton;
            private var radioButton3:RadioButton;
            private var radioButton4:RadioButton;
            private var radioButton5:RadioButton;

            private function init():void {
                lbl = new Label();
                lbl.setStyle("fontWeight", "bold");

                var appControlBar:ApplicationControlBar;
                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(lbl);
                Application.application.addChildAt(appControlBar, 0);

                radioGroup = new RadioButtonGroup();
                radioGroup.addEventListener(ItemClickEvent.ITEM_CLICK,
                            radioGroup_itemClick);

                radioButton1 = new RadioButton();
                radioButton1.label = "Red";
                radioButton1.group = radioGroup;

                radioButton2 = new RadioButton();
                radioButton2.label = "Orange";
                radioButton2.group = radioGroup;

                radioButton3 = new RadioButton();
                radioButton3.label = "Yellow";
                radioButton3.group = radioGroup;

                radioButton4 = new RadioButton();
                radioButton4.label = "Green";
                radioButton4.group = radioGroup;

                radioButton5 = new RadioButton();
                radioButton5.label = "Blue";
                radioButton5.group = radioGroup;

                var vBox:VBox = new VBox();
                vBox.addChild(radioButton1);
                vBox.addChild(radioButton2);
                vBox.addChild(radioButton3);
                vBox.addChild(radioButton4);
                vBox.addChild(radioButton5);
                addChild(vBox);
            }

            private function radioGroup_itemClick(evt:ItemClickEvent):void {
                var now:String = new Date().toTimeString();
                lbl.text = evt.label + " (" + now + ")";
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<p>For an example of detecting when a RadioButton selection has changed using the RadioButton control&#8217;s <code>change</code> event or the RadioButtonGroup&#8217;s <code>change</code> event, see <a href="http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/">&#8220;Determining when the selected radio button has changed&#8221;</a>.</p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Detecting when a RadioButton has been clicked in a RadioButtonGroup in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/',contentID: 'post-678',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'itemClick',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/21/detecting-when-a-radiobutton-has-been-clicked-in-a-radiobuttongroup-in-flex/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Looping over RadioButton controls in a RadioButtonGroup in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 06:58:52 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[getRadioButtonAt()]]></category>
		<category><![CDATA[numRadioButtons]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can loop over the RadioButton controls in a Flex RadioButtonGroup by using the numRadioButtons property and getRadioButtonAt() method.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_numRadioButtons_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; private function showAlert():void { var arr:Array [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can loop over the RadioButton controls in a Flex RadioButtonGroup by using the <code>numRadioButtons</code> property and <code>getRadioButtonAt()</code> method.</p>
<p>Full code after the jump.</p>
<p><span id="more-677"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_numRadioButtons_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;

            private function showAlert():void {
                var arr:Array = [];
                var rb:RadioButton;
                var idx:int;
                var len:int = radioGroup.numRadioButtons;

                for (idx=0; idx&lt;len; idx++) {
                    rb = radioGroup.getRadioButtonAt(idx);
                    arr.push("index:" + idx + ", label:" + rb.label);
                }
                Alert.show(arr.join("\\n"), "getRadioButtonAt():");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Button label="Click me" click="showAlert();" /&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id="radioGroup" /&gt;

    &lt;mx:VBox&gt;
        &lt;mx:RadioButton id="radioButton1" label="One" /&gt;
        &lt;mx:RadioButton id="radioButton2" label="Two" /&gt;
        &lt;mx:RadioButton id="radioButton3" label="Three" /&gt;
        &lt;mx:RadioButton id="radioButton4" label="Four" /&gt;
        &lt;mx:RadioButton id="radioButton5" label="Five" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_numRadioButtons_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_numRadioButtons_test/bin/main.html" width="100%" height="300"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Looping over RadioButton controls in a RadioButtonGroup in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/',contentID: 'post-677',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getRadioButtonAt(),numRadioButtons',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/20/looping-over-radiobutton-controls-in-a-radiobuttongroup-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enabling and disabling RadioButton controls in a RadioButtonGroup in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/#comments</comments>
		<pubDate>Fri, 20 Jun 2008 04:20:43 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[enabled]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the visibility of all of the RadioButton controls in a Flex RadioButtonGroup by setting the enabled property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; &#60;mx:FormItem label="enabled:"&#62; &#60;mx:CheckBox id="checkBox" selected="true" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the visibility of all of the RadioButton controls in a Flex RadioButtonGroup by setting the <code>enabled</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-676"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="enabled:"&gt;
                &lt;mx:CheckBox id="checkBox"
                        selected="true" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id="radioGroup"
            enabled="{checkBox.selected}" /&gt;

    &lt;mx:VBox horizontalAlign="left"&gt;
        &lt;mx:RadioButton id="radioButton1"
                label="Red"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton2"
                label="Orange"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton3"
                label="Yellow"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton4"
                label="Green"
                group="{radioGroup}" /&gt;
        &lt;mx:RadioButton id="radioButton5"
                label="Blue"
                group="{radioGroup}" /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/main.html" width="100%" height="250"></iframe></p>
<p>You can also set the RadioButtonGroup&#8217;s <code>enabled</code> property using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    <strong style="color:red;">&lt;mx:Script&gt;
        &lt;![CDATA[
            private function checkBox_change(evt:Event):void {
                radioGroup.enabled = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;</strong>

    &lt;mx:ApplicationControlBar dock=&quot;true&quot;&gt;
        &lt;mx:Form styleName=&quot;plain&quot;&gt;
            &lt;mx:FormItem label=&quot;enabled:&quot;&gt;
                &lt;mx:CheckBox id=&quot;checkBox&quot;
                        selected=&quot;true&quot;
                        <strong style="color:red;">change=&quot;checkBox_change(event);&quot;</strong> /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id=&quot;radioGroup&quot; /&gt;

    &lt;mx:VBox horizontalAlign=&quot;left&quot;&gt;
        &lt;mx:RadioButton id=&quot;radioButton1&quot;
                label=&quot;Red&quot;
                group=&quot;{radioGroup}&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton2&quot;
                label=&quot;Orange&quot;
                group=&quot;{radioGroup}&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton3&quot;
                label=&quot;Yellow&quot;
                group=&quot;{radioGroup}&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton4&quot;
                label=&quot;Green&quot;
                group=&quot;{radioGroup}&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton5&quot;
                label=&quot;Blue&quot;
                group=&quot;{radioGroup}&quot; /&gt;
    &lt;/mx:VBox&gt;

&lt;/mx:Application&gt;
</pre>
<p>Due to popular demand, here is the &#8220;same&#8221; example in a more ActionScript friendly format:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_enabled_test/bin/srcview/source/main3.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.containers.ApplicationControlBar;
            import mx.containers.Form;
            import mx.containers.FormItem;
            import mx.containers.VBox;
            import mx.controls.CheckBox;
            import mx.controls.RadioButton;
            import mx.controls.RadioButtonGroup;

            private var checkBox:CheckBox;
            private var radioGroup:RadioButtonGroup;
            private var radioButton1:RadioButton;
            private var radioButton2:RadioButton;
            private var radioButton3:RadioButton;
            private var radioButton4:RadioButton;
            private var radioButton5:RadioButton;

            private function init():void {
                var appControlBar:ApplicationControlBar;
                var form:Form;
                var formItem:FormItem;

                checkBox = new CheckBox();
                checkBox.selected = true;
                checkBox.addEventListener(Event.CHANGE, checkBox_change);

                formItem = new FormItem();
                formItem.label = "enabled:";
                formItem.addChild(checkBox);

                form = new Form();
                form.styleName = "plain";
                form.addChild(formItem);

                appControlBar = new ApplicationControlBar();
                appControlBar.dock = true;
                appControlBar.addChild(form);
                Application.application.addChildAt(appControlBar, 0);

                radioGroup = new RadioButtonGroup();

                radioButton1 = new RadioButton();
                radioButton1.label = "Red";
                radioButton1.group = radioGroup;

                radioButton2 = new RadioButton();
                radioButton2.label = "Orange";
                radioButton2.group = radioGroup;

                radioButton3 = new RadioButton();
                radioButton3.label = "Yellow";
                radioButton3.group = radioGroup;

                radioButton4 = new RadioButton();
                radioButton4.label = "Green";
                radioButton4.group = radioGroup;

                radioButton5 = new RadioButton();
                radioButton5.label = "Blue";
                radioButton5.group = radioGroup;

                var vBox:VBox = new VBox();
                vBox.addChild(radioButton1);
                vBox.addChild(radioButton2);
                vBox.addChild(radioButton3);
                vBox.addChild(radioButton4);
                vBox.addChild(radioButton5);
                addChild(vBox);
            }

            private function checkBox_change(evt:Event):void {
                radioGroup.enabled = checkBox.selected;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Enabling and disabling RadioButton controls in a RadioButtonGroup in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/',contentID: 'post-676',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'enabled',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/19/enabling-and-disabling-radiobutton-controls-in-a-radiobuttongroup-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting the label placement on a RadioButtonGroup in Flex</title>
		<link>http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 07:23:08 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[labelPlacement]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can set the label placement on a series of RadioButton controls in a Flex RadioButtonGroup by setting the labelPlacement property.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_labelPosition_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:ApplicationControlBar dock="true"&#62; &#60;mx:Form styleName="plain"&#62; &#60;mx:FormItem label="labelPlacement:"&#62; &#60;mx:ComboBox id="comboBox" [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can set the label placement on a series of RadioButton controls in a Flex RadioButtonGroup by setting the <code>labelPlacement</code> property.</p>
<p>Full code after the jump.</p>
<p><span id="more-674"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_labelPosition_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="labelPlacement:"&gt;
                &lt;mx:ComboBox id="comboBox"
                        dataProvider="[left, right, top, bottom]"
                        selectedIndex="1" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id="radioGroup"
            labelPlacement="{comboBox.selectedItem}" /&gt;

    &lt;mx:HBox horizontalAlign="left" verticalGap="15"&gt;
        &lt;mx:RadioButton id="radioButton1"
                label="Red"
                group="{radioGroup}"
                opaqueBackground="0xFF00FF" /&gt;
        &lt;mx:RadioButton id="radioButton2"
                label="Orange"
                group="{radioGroup}"
                opaqueBackground="0xFF00FF" /&gt;
        &lt;mx:RadioButton id="radioButton3"
                label="Yellow"
                group="{radioGroup}"
                opaqueBackground="0xFF00FF" /&gt;
        &lt;mx:RadioButton id="radioButton4"
                label="Green"
                group="{radioGroup}"
                opaqueBackground="0xFF00FF" /&gt;
        &lt;mx:RadioButton id="radioButton5"
                label="Blue"
                group="{radioGroup}"
                opaqueBackground="0xFF00FF" /&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_labelPosition_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_labelPosition_test/bin/main.html" width="100%" height="150"></iframe></p>
<p>You can also set the <code>labelPlacement</code> property using ActionScript, as seen in the following example:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_labelPosition_test/bin/srcview/source/main2.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
&lt;!-- http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/ --&gt;
&lt;mx:Application xmlns:mx=&quot;http://www.adobe.com/2006/mxml&quot;
        layout=&quot;vertical&quot;
        verticalAlign=&quot;middle&quot;
        backgroundColor=&quot;white&quot;&gt;

    <strong style="color:red;">&lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.events.ListEvent;

            private function comboBox_change(evt:ListEvent):void {
                var value:String = evt.currentTarget.selectedItem;
                radioGroup.labelPlacement = value;
            }
        ]]&gt;
    &lt;/mx:Script&gt;</strong>

    &lt;mx:ApplicationControlBar dock=&quot;true&quot;&gt;
        &lt;mx:Form styleName=&quot;plain&quot;&gt;
            &lt;mx:FormItem label=&quot;labelPlacement:&quot;&gt;
                &lt;mx:ComboBox id=&quot;comboBox&quot;
                        dataProvider=&quot;[left, right, top, bottom]&quot;
                        selectedIndex=&quot;1&quot;
                        <strong style="color:red;">change=&quot;comboBox_change(event);&quot;</strong> /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:RadioButtonGroup id=&quot;radioGroup&quot; /&gt;

    &lt;mx:HBox horizontalAlign=&quot;left&quot;&gt;
        &lt;mx:RadioButton id=&quot;radioButton1&quot;
                label=&quot;Red&quot;
                group=&quot;{radioGroup}&quot;
                opaqueBackground=&quot;0xFF00FF&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton2&quot;
                label=&quot;Orange&quot;
                group=&quot;{radioGroup}&quot;
                opaqueBackground=&quot;0xFF00FF&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton3&quot;
                label=&quot;Yellow&quot;
                group=&quot;{radioGroup}&quot;
                opaqueBackground=&quot;0xFF00FF&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton4&quot;
                label=&quot;Green&quot;
                group=&quot;{radioGroup}&quot;
                opaqueBackground=&quot;0xFF00FF&quot; /&gt;
        &lt;mx:RadioButton id=&quot;radioButton5&quot;
                label=&quot;Blue&quot;
                group=&quot;{radioGroup}&quot;
                opaqueBackground=&quot;0xFF00FF&quot; /&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Setting the label placement on a RadioButtonGroup in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/',contentID: 'post-674',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'labelPlacement',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/06/19/setting-the-label-placement-on-a-radiobuttongroup-in-flex/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Displaying RadioButton controls using the Repeater in Flex</title>
		<link>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/#comments</comments>
		<pubDate>Wed, 28 May 2008 13:43:15 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[Repeater]]></category>
		<category><![CDATA[getRepeaterItem()]]></category>
		<category><![CDATA[selectedValue]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can display a series of RadioButtons using the Flex Repeater with an Array data provider.</p> <p>Full code after the jump.</p> <p></p> <p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Repeater_RadioButton_test/bin/srcview/source/main.mxml.html">View MXML</a></p> &#60;?xml version="1.0" encoding="utf-8"?&#62; &#60;!-- http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/ --&#62; &#60;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical" verticalAlign="middle" backgroundColor="white"&#62; &#60;mx:Style&#62; Alert { backgroundAlpha: 0.8; backgroundColor: black; borderAlpha: 0.8; borderColor: black; } &#60;/mx:Style&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can display a series of RadioButtons using the Flex Repeater with an Array data provider.</p>
<p>Full code after the jump.</p>
<p><span id="more-648"></span></p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/Repeater_RadioButton_test/bin/srcview/source/main.mxml.html">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Style&gt;
        Alert {
            backgroundAlpha: 0.8;
            backgroundColor: black;
            borderAlpha: 0.8;
            borderColor: black;
        }
    &lt;/mx:Style&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            import mx.controls.Alert;
            import mx.controls.RadioButton;

            private function radioButton_change(evt:Event):void {
                var radio:RadioButton = RadioButton(evt.currentTarget);
                var item:Object = radio.getRepeaterItem();
                var cssObj:CSSStyleDeclaration;
                cssObj = StyleManager.getStyleDeclaration("Alert");
                cssObj.setStyle("modalTransparencyColor", item.data);
                cssObj.setStyle("themeColor", item.data);
                Alert.show(item.label, "getRepeaterItem()");
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:Array id="arr"&gt;
        &lt;mx:Object label="Red" data="red" /&gt;
        &lt;mx:Object label="Orange" data="haloOrange" /&gt;
        &lt;mx:Object label="Yellow" data="yellow" /&gt;
        &lt;mx:Object label="Green" data="haloGreen" /&gt;
        &lt;mx:Object label="Blue" data="haloBlue" /&gt;
    &lt;/mx:Array&gt;

    &lt;mx:ApplicationControlBar dock="true"&gt;
        &lt;mx:Form styleName="plain"&gt;
            &lt;mx:FormItem label="selectedValue:"&gt;
                &lt;mx:Label text="{radioGroup.selectedValue}" /&gt;
            &lt;/mx:FormItem&gt;
        &lt;/mx:Form&gt;
    &lt;/mx:ApplicationControlBar&gt;

    &lt;mx:HBox id="hb" horizontalGap="60"&gt;
        &lt;mx:RadioButtonGroup id="radioGroup" /&gt;
        &lt;mx:Repeater id="radioRepeater"
                dataProvider="{arr}"&gt;
            &lt;mx:RadioButton id="radioButtons"
                    label="{radioRepeater.currentItem.label}"
                    group="{radioGroup}"
                    change="radioButton_change(event);" /&gt;
        &lt;/mx:Repeater&gt;
    &lt;/mx:HBox&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/Repeater_RadioButton_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/Repeater_RadioButton_test/bin/main.html" width="100%" height="150"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Displaying RadioButton controls using the Repeater in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/',contentID: 'post-648',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'getRepeaterItem(),selectedValue',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/05/28/displaying-radiobutton-controls-using-the-repeater-in-flex/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Clearing a selected RadioButton control in Flex</title>
		<link>http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/</link>
		<comments>http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/#comments</comments>
		<pubDate>Sun, 06 Jan 2008 08:29:29 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[selectedValue]]></category>
		<category><![CDATA[selection]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/</guid>
		<description><![CDATA[<p>The following example shows how you can use ActionScript to clear a currently selected radio button by setting the RadioButtonGroup class&#8217;s selection property to null.</p> <p></p> &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;!-- http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/ --&#62; &#60;mx:Application name=&#34;RadioButtonGroup_selection_test&#34; xmlns:mx=&#34;http://www.adobe.com/2006/mxml&#34; layout=&#34;vertical&#34; verticalAlign=&#34;middle&#34; backgroundColor=&#34;white&#34;&#62; &#160; &#60;mx:Script&#62; &#60;![CDATA[ import mx.controls.Alert; &#160; private function reset():void { answers.selection = null; } &#160; private function [...]]]></description>
			<content:encoded><![CDATA[<p>The following example shows how you can use ActionScript to clear a currently selected radio button by setting the RadioButtonGroup class&#8217;s <code>selection</code> property to <code>null</code>.</p>
<p><span id="more-419"></span></p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #808080; font-style: italic;">&lt;!-- http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/ --&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Application</span> name=<span style="color: #ff0000;">&quot;RadioButtonGroup_selection_test&quot;</span></span>
<span style="color: #000000;">        xmlns:mx=<span style="color: #ff0000;">&quot;http://www.adobe.com/2006/mxml&quot;</span></span>
<span style="color: #000000;">        layout=<span style="color: #ff0000;">&quot;vertical&quot;</span></span>
<span style="color: #000000;">        verticalAlign=<span style="color: #ff0000;">&quot;middle&quot;</span></span>
<span style="color: #000000;">        backgroundColor=<span style="color: #ff0000;">&quot;white&quot;</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
    <span style="color: #339933;">&lt;mx:Script&gt;</span>
<span style="color: #339933;">        &lt;![CDATA[</span>
<span style="color: #339933;">            import mx.controls.Alert;</span>
&nbsp;
<span style="color: #339933;">            private function reset():void {</span>
<span style="color: #339933;">                answers.selection = null;</span>
<span style="color: #339933;">            }</span>
&nbsp;
<span style="color: #339933;">            private function check():void {</span>
<span style="color: #339933;">                if (answers.selectedValue) {</span>
<span style="color: #339933;">                    Alert.show(answers.selectedValue.toString());</span>
<span style="color: #339933;">                } else {</span>
<span style="color: #339933;">                    Alert.show(&quot;unselected&quot;);</span>
<span style="color: #339933;">                }</span>
<span style="color: #339933;">            }</span>
<span style="color: #339933;">        ]]&gt;</span>
<span style="color: #339933;">    &lt;/mx:Script&gt;</span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButtonGroup</span> id=<span style="color: #ff0000;">&quot;answers&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
&nbsp;
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span> backgroundColor=<span style="color: #ff0000;">&quot;red&quot;</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Text</span> id=<span style="color: #ff0000;">&quot;question&quot;</span></span>
<span style="color: #000000;">                    text=<span style="color: #ff0000;">&quot;Question...&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> id=<span style="color: #ff0000;">&quot;answer1&quot;</span></span>
<span style="color: #000000;">                    group=<span style="color: #ff0000;">&quot;{answers}&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;Answer 1&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> id=<span style="color: #ff0000;">&quot;answer2&quot;</span></span>
<span style="color: #000000;">                    group=<span style="color: #ff0000;">&quot;{answers}&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;Answer 2&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> id=<span style="color: #ff0000;">&quot;answer3&quot;</span></span>
<span style="color: #000000;">                    group=<span style="color: #ff0000;">&quot;{answers}&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;Answer 3&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> id=<span style="color: #ff0000;">&quot;answer4&quot;</span></span>
<span style="color: #000000;">                    group=<span style="color: #ff0000;">&quot;{answers}&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;Answer 4&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:RadioButton</span> id=<span style="color: #ff0000;">&quot;answer5&quot;</span></span>
<span style="color: #000000;">                    group=<span style="color: #ff0000;">&quot;{answers}&quot;</span></span>
<span style="color: #000000;">                    label=<span style="color: #ff0000;">&quot;Answer 5&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> direction=<span style="color: #ff0000;">&quot;horizontal&quot;</span><span style="color: #7400FF;">&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Check&quot;</span> click=<span style="color: #ff0000;">&quot;check();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
            <span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Button</span> label=<span style="color: #ff0000;">&quot;Reset&quot;</span> click=<span style="color: #ff0000;">&quot;reset();&quot;</span> <span style="color: #7400FF;">/&gt;</span></span>
        <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
    <span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
&nbsp;
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<div span="googleAdsLeaderboard">
<script type="text/javascript"><!--
google_ad_client = "pub-3325829455487492";
/* 728x90, created 7/15/09 */
google_ad_slot = "6403511741";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br />
</div>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_selection_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_selection_test/bin/main.html" width="100%" height="350"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Clearing a selected RadioButton control in Flex on FlexExamples.com',url: 'http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/',contentID: 'post-419',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'selectedValue,selection',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2008/01/06/clearing-a-selected-radiobutton-control-in-flex/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>Determining when the selected radio button has changed</title>
		<link>http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/</link>
		<comments>http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 14:25:23 +0000</pubDate>
		<dc:creator>Peter deHaan</dc:creator>
				<category><![CDATA[RadioButton]]></category>
		<category><![CDATA[RadioButtonGroup]]></category>
		<category><![CDATA[change]]></category>
		<category><![CDATA[group]]></category>

		<guid isPermaLink="false">http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/</guid>
		<description><![CDATA[<p>The following examples show how you can detect when the user has selected a different radio button by listening for the change event on the RadioButton control or RadioButtonGroup control.</p> <p>Full code after the jump.</p> <p></p> <p>The first example demonstrates how you can listen for the change event on each individual radio button:</p> <p class="download"><a [...]]]></description>
			<content:encoded><![CDATA[<p>The following examples show how you can detect when the user has selected a different radio button by listening for the <code>change</code> event on the RadioButton control or RadioButtonGroup control.</p>
<p>Full code after the jump.</p>
<p><span id="more-242"></span></p>
<p>The first example demonstrates how you can listen for the <code>change</code> event on each individual radio button:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_change_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function rb_change(evt:Event):void {
                var rb:RadioButton = evt.currentTarget as RadioButton;
                lbl.text = rb.label;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:VBox&gt;
        &lt;mx:RadioButton id="rb1"
                label="One"
                change="rb_change(event);" /&gt;
        &lt;mx:RadioButton id="rb2"
                label="Two"
                change="rb_change(event);" /&gt;
        &lt;mx:RadioButton id="rb3"
                label="Three"
                change="rb_change(event);" /&gt;
    &lt;/mx:VBox&gt;

    &lt;mx:Label id="lbl" fontWeight="bold" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButton_change_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButton_change_test/bin/main.html" width="100%" height="200"></iframe></p>
<p>The second example demonstrates how you can listen for the <code>change</code> event on the radio button group:</p>
<p class="download"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_change_test/main.mxml">View MXML</a></p>
<pre class="code">
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!-- http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/ --&gt;
&lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
        layout="vertical"
        verticalAlign="middle"
        backgroundColor="white"&gt;

    &lt;mx:Script&gt;
        &lt;![CDATA[
            private function rbg_change(evt:Event):void {
                var group:RadioButtonGroup = evt.currentTarget as RadioButtonGroup;
                lbl.text = group.selection.label;
            }
        ]]&gt;
    &lt;/mx:Script&gt;

    &lt;mx:RadioButtonGroup id="rbg"
            change="rbg_change(event);" /&gt;

    &lt;mx:VBox&gt;
        &lt;mx:RadioButton id="rb1"
                label="One"
                group="{rbg}" /&gt;
        &lt;mx:RadioButton id="rb2"
                label="Two"
                group="{rbg}" /&gt;
        &lt;mx:RadioButton id="rb3"
                label="Three"
                group="{rbg}" /&gt;
    &lt;/mx:VBox&gt;

    &lt;mx:Label id="lbl" fontWeight="bold" /&gt;

&lt;/mx:Application&gt;
</pre>
<p class="information"><a href="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_change_test/bin/srcview/index.html">View source</a> is enabled in the following example.</p>
<p><iframe src="http://blog.flexexamples.com/wp-content/uploads/RadioButtonGroup_change_test/bin/main.html" width="100%" height="200"></iframe></p>
<div class="evernoteSiteMemory"><a href="javascript:" onclick="Evernote.doClip({title: 'Determining when the selected radio button has changed on FlexExamples.com',url: 'http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/',contentID: 'post-242',code: 'Pete9667',suggestNotebook: 'FlexExamples',suggestTags: 'change,group',providerName: 'FlexExamples.com',styling: 'text' });return false" class="evernoteSiteMemoryLink"><img src="http://static.evernote.com/article-clipper-remember.png" class="evernoteSiteMemoryButton" />
				</a>				<div class="evernoteSiteMemoryClear">&nbsp;</div>
</div>]]></content:encoded>
			<wfw:commentRss>http://blog.flexexamples.com/2007/10/19/determining-when-the-selected-radio-button-has-changed/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

