I have four radio button groups with ten buttons in each group. Everything is created at run-time. A separate function creates each group of radio buttons. The code works fine until the user makes his/her selections and clicks on the “Continue” button. At that point, I receive the following error:
ReferenceError: Error #1069: Property group not found on fl.controls.RadioButtonGroup and there is no default value.
at EncVarstudyNEWwithCatchTrials4_fla::MainTimeline/recordBackgroundSelections()
I cannot figure out what I can do to remedy this error. Since the code I’m using is quite long, I’ll just post relevant snippets since a lot of it is repeated. The first code creates a radio button and adds it to the stage; the function repeats that code nine more times to make one set of ten buttons. There are three other sets of variable declarations and functions for the other groups of buttons.
var rbgPres1 = new RadioButtonGroup("RBGPres1_");
var rb11:RadioButton;
var rb12:RadioButton;
var rb13:RadioButton;
var rb14:RadioButton;
var rb15:RadioButton;
var rb16:RadioButton;
var rb17:RadioButton;
var rb18:RadioButton;
var rb19:RadioButton;
var rb110:RadioButton;
function createRBgroups1():void
{
rb11 = new RadioButton();
rb11.label = "Orange";
rb11.width = 200;
rb11.x = 23.75;
rb11.y = 278.95;
rb11.group = rbgPres1;
addChild(rb11); ... and so on
I think the problem might be with the function, below, that executes when the user clicks the “Submit” button.
function recordBackgroundSelections(evt:MouseEvent):void {
if(numberAnswer*=="1")
{
BCtype1*=String(rbgPres1.group.selectedData)
if(BCtype1*!="")
{
BCtype2*=String("NA");
BCtype3*=String("NA");
BCtype4*=String("NA");
btnSubmit.removeEventListener(MouseEvent.CLICK,recordBackgroundSelections)
finalOutput();
}
}
else if(numberAnswer*=="2")
{
BCtype1*=String(rbgPres1.group.selectedData)
BCtype2*=String(rbgPres2.group.selectedData)
if(BCtype1*!="" && BCtype2*!="")
{
BCtype3*=String("NA");
BCtype4*=String("NA");
btnSubmit.removeEventListener(MouseEvent.CLICK,recordBackgroundSelections)
finalOutput();
}
}
else if(numberAnswer*=="3")
{
BCtype1*=String(rbgPres1.group.selectedData)
BCtype2*=String(rbgPres2.group.selectedData)
BCtype3*=String(rbgPres3.group.selectedData)
if(BCtype1*!="" && BCtype2*!="" && BCtype3*!="")
{
BCtype4*=String("NA");
btnSubmit.removeEventListener(MouseEvent.CLICK,recordBackgroundSelections)
finalOutput();
}
}
else
{
BCtype1*=String(rbgPres1.group.selectedData)
BCtype2*=String(rbgPres2.group.selectedData)
BCtype3*=String(rbgPres3.group.selectedData)
BCtype4*=String(rbgPres4.group.selectedData)
if(BCtype1*!="" && BCtype2*!="" && BCtype3*!="" && BCtype4*!="")
{
btnSubmit.removeEventListener(MouseEvent.CLICK,recordBackgroundSelections)
finalOutput();
}
}
}
I’ve tried everything I know to make this work–so far, I’ve no idea how to fix whatever is wrong. Thanks for any help!