How to deselect a RadioButtonGroup?

I try it using the next code but fails.

After the application is loaded, I click the "getValue" button and the
label displays "Value: undefined" (this behaviour is ok). Then I click
the "Female" RadioButton and click the "getValue" button and the label
displays "Value: F" (this behaviour is ok too). Finally, I click the
"setUndefined" button to make the RadioButtonGroup selection undefined.

In fact, the RadioButtonGroup has nothing selected visually but
when I click the "getValue" button the label displays "Value: F". I
wish the label displays again "Value: undefined"


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
        <mx:Script>
        <![CDATA[
                function btnGetValue_Click():Void {
                        lblValue.text="Value: "+rgpSex.selectedData.toString();
                } // btnGetValue_Click
                
                function btnSetUndefined_Click():Void {
                        rgpSex.selection.selected=false;
                        rgpSex.selection=undefined;
                } // btnSetUndefined_Click
        ]]>
        </mx:Script>
        
        <mx:RadioButtonGroup id="rgpSex" />
        <mx:RadioButton id="optM" label="Male" groupName="rgpSex" data="M" />
        <mx:RadioButton id="optF" label="Female" groupName="rgpSex" data="F" />
        
        <mx:Button label="getValue" click="btnGetValue_Click()" />
        <mx:Button label="setUndefined" click="btnSetUndefined_Click()" />
        
        <mx:Label id="lblValue" />
</mx:Application>








------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/I258zB/QnQLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to