开发者

I need to reset or deselect a group of radio buttons in AS3

I need to reset or deselect a开发者_开发问答 group of radio buttons. How do I do that ?


you can set the selected property to true but not false. so add a "dummy" radio button to the group (no need to add it to the display list) and use it:

var rbDummy:RadioButton=new RadioButton();
rbDummy.group = rb1.group;


function reStart(evt:MouseEvent):void {
     rbDummy.selected = true;

}

https://forums.adobe.com/thread/436875


You can make additional unvisible radiobutton and check it programaticcaly.


You can set its selection property to null

radioButtonGroup.selection = null

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:RadioButtonGroup id="radioButtonGroup" />
    <mx:VBox>


    <mx:RadioButton id="a"  label="A" groupName="radioButtonGroup"/>
    <mx:RadioButton id="b" label="B" groupName="radioButtonGroup"/>
    <mx:RadioButton id="c" label="C" groupName="radioButtonGroup"/>

    <mx:Button id="btn" label="Unselect" click="{radioButtonGroup.selection = null}"/>
    </mx:VBox>
</mx:Application>

hopes that helps

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜