2011-04-03 255 views

回答

3

獲取對當前RadioButtonGroup的引用並訪問選擇參考,這將返回對組中選定的當前單選按鈕的引用。

http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/fl/controls/RadioButtonGroup.html

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語句,像這樣:

if(radioButton1.selected == true){ 

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

} 
0
import fl.controls.RadioButton; 
    import fl.controls.RadioButtonGroup 
    var paymentGroup:RadioButtonGroup = new RadioButtonGroup("paymentOption"); 
    rb1.group = paymentGroup; 
    rb2.group = paymentGroup; 
    paymentGroup.addEventListener(Event.CHANGE,handlerRbg); 
    function handlerRbg(e:Event):void 
    { 
     var rbg:RadioButtonGroup = e.target as RadioButtonGroup; 
     trace(rbg.selectedData); 
    } 
相關問題