PDA

View Full Version : How to get the value of a radio button



kitsunegari
April 28th, 2008, 09:51 PM
Hi

I'm using the Radio Button component of flash and I drag and drop it on my scene.

I named the RadioButtonGroup as "test" but my problem is that I can't get the value of the selected button.

If I do:

trace(test.selectedData);I get the following error message: 1120: Access of undefined property test.

But I set the RadioButtonGroup as test in the property panel of each button.
What's wrong?

Many thanks for your help

Tazz
April 29th, 2008, 08:46 AM
Hi.
Did you give the radio button a component name (Parameters window)? You only need to name the first radio button in the group, ex radiogroup1. Create an object variable which points to the group of the component and then trace the selectedData:

var myObject:Object = radiogroup1.group;
trace(myObject.selectedData);

groupName only makes the radio buttons behave as a group.