Monday, March 22, 2010

how to get the name of radio button

hopw to get the name of selected option button

var myRadioGroup:RadioButtonGroup=new RadioButtonGroup(''options'');

for (i=0; i%26lt;5; i++) {
聽聽聽 radio.group=myRadioGroup;
聽聽聽 radio.label='''';
聽聽聽 radio.value=i;
聽聽聽 radio.move(10, int(int(55)+(105*y_counter)));
聽聽聽 myRadioGroup.addEventListener(Event.CHANGE, changeHandler);
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽 addChild(radio);
}

function changeHandler(event:Event):void
{
聽聽聽聽聽聽聽聽聽 var rbg:RadioButtonGroup = event.target as RadioButtonGroup;
聽聽聽聽聽聽聽聽聽 var rb:RadioButton = rbg.selection;
聽聽聽聽聽聽聽 //how to get the name of selected option button
}

how to get the name of radio button

iam not clear about what name u are asking because there is no property called ''name''

anyway i think u are looking for this.

if u want the label(the option that u have selected) of the selected option then the below code will do it.

radiogroup1.selectedvalue.tostring();

if u want the id of the selected radio button the below code will do it.

radiogroup1.selection.tostring();

if this post answers your question then mark as such.

how to get the name of radio button

i have to create 5 radio button with id or name 1to 5.

and on clicking of any radio button i want to know the name or id of that radio button聽 like 1 ,2


then this woud help

radiogroup.selection.tostring() will give u the name but along with the project name like the one below

projectname.radiobutton

if this answers please mark as such


i m not able to find the name聽 please tell me more how to do that .


declare one string variable like

var str:String;

now assign the radiobutton name like this.

str=radiogroup.selection.tostring()

now str would contain the name of the button

No comments:

Post a Comment