Though in looking at the name of your
radio button I’m guessing you’re resetting a form, in which case
the selectedRadio trick is the thing to try.
From: Matt Chotin
Sent: Thursday, December 08, 2005
10:19 PM
To: 'flexcoders@yahoogroups.com'
Subject: RE: [flexcoders] How to
deselect a RadioButtonGroup?
The only way to do this is undocumented
and therefore probably won’t work in Flex 2.0. Set
rgpSex.selectedRadio = undefined;
Normally I don’t think a UI lets you
de-select a radio group though, instead you should have an option for
“none”
Matt
From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of huhgawz
Sent: Wednesday, December 07, 2005
6:11 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] How to
deselect a RadioButtonGroup?
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="" />
<mx:RadioButton
id="optF" label="Female" groupName="rgpSex"
data="" />
<mx:Button
label="getValue" click="btnGetValue_Click()" />
<mx:Button
label="setUndefined" click="btnSetUndefined_Click()" />
<mx:Label
id="lblValue" />
</mx:Application>
--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com
SPONSORED LINKS
YAHOO! GROUPS LINKS