闪存单选按钮:我如何才能所选的单选按钮? [英] Flash radiobutton: how do I get the selected radiobutton?

查看:185
本文介绍了闪存单选按钮:我如何才能所选的单选按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个单选按钮我拖放同一组中。在main.as我添加点击事件监听器。

I have a few radiobuttons I drag and drop within same group. In main.as I added click event listener.

如何获得所选择的单选按钮?处理目标参数不包含任何引用。

How do I get the selected radiobutton ? handler target argument doesn't contain any reference to it.

推荐答案

抢参考目前的RadioButtonGroup,并访问选择的参考,这将返回一个引用到组中选定当前单选按钮。

Grab a reference to the current RadioButtonGroup and access the selection reference, this will return a reference to the current radio button that is selected in the group.

<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButtonGroup.html" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButtonGroup.html

<一个href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButton.html#group" rel="nofollow">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButton.html#group

var rbg:RadioButtonGroup = RadioButton(e.currentTarget).group;

var selectedRadioButton:RadioButton = rbg.selection;

//Get the group name
trace(selectedRadioButton.groupName);

或者你可以有你的单选按钮的复合if语句,像这样:

Alternatively you can just have your radio buttons in a compounded if statement like so:

if(radioButton1.selected == true){

}else if (radioButton2.selected == true){

}

这篇关于闪存单选按钮:我如何才能所选的单选按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆