Hi all,
I’m trying to use the Radio Button component in an AS3 project, and have a problem:
I’ve got my group of radio buttons all working nicely, and when the user clicks on one, I’m getting the associated value successfully like this:
var group:RadioButtonGroup = RadioButtonGroup.getGroup("myGroup");
trace("The currently selected radio button value is: " + group.selection.value);
But the problem arises if the user hasn’t yet made any selection of any of the radio buttons, so none of them are selected. The above code throws me an error:
“Error #1009: Cannot access a property or method of a null object reference.”
This is a state that I want to be able to capture, so that I can do something like:
if (group.selection.value==null) {
trace("ask user to select a button before proceeding...");
}
… but no can do as group.selection.value just gives me the above error.
How can I test for the state where no buttons have been pressed?