Friday, March 26, 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