RadioButton groups calculation!

Hello again,

I had posted a problem similar to this one a few days ago dealing with Checkbox calculations.

Well I got that one all figured out, but it turnes out I couldnt use that. What I need to figure out, is how to add up several groups of checkboxes. So again, bellow you’ll find the fla in the zip.

I’ve //included explanations (saying what it is doing) for every code section, and at the bottom I noted the section where I think the problem lives. Its only adding the first EventListener of each group.
Sooo, Many hours later, I just cant seem to figure it out. Help!

here is the code and a snap shot, for who ever doesnt want to bother with opening the file… at first :block: . because who can resist :slight_smile:

[URL=“ImageShack - Best place for all of your image hosting and image sharing needs”]

[URL=“ImageShack - Best place for all of your image hosting and image sharing needs”]

Thanx much, for who ever takes on the challenge.

//Here I will place the buttons in the A and B Group.
A1.group = AGroup;
A2.group = AGroup;
B1.group = BGroup;
B2.group = BGroup;

//Here I declare the cost.
var AOff:Number = 0;
var BOff:Number = 0;
var A1On:Number = 100;
var A2On:Number = 200;
var B1On:Number = 10;
var B2On:Number = 20;

//This is the innitial setting for the buttons. ( check that it maches w/ button setting)
var A:Number = A1On; //RadioButtun $100 is on.
var B:Number = B1On; //RadioButtun $10 is on.
Total.text = A + B; //Total box is adding A+B (100+10).

//Here I create the formula for the A1 selection.
A1Listener = new Object();
A1Listener.click = function() {
if (A1.selected) {
A = A1On;
}
else {
A = AOff;
}
Total.text = A + B;
Trace ( A + B );
};

//Here I create the formula for the A2 selection.
A2Listener = new Object();
A2Listener.click = function() {
if (A2.selected) {
A = A2On;
}
else {
A = AOff;
}
Total.text = A + B;
};

//Here I create the formula for the B1 selection.
B1Listener = new Object();
B1Listener.click = function() {
if (B1.selected) {
B = B1On;
}
else {
B = BOff;
}
Total.text = A + B;
Trace ( A + B );
};

//Here I create the formula for the B2 selection.
B2Listener = new Object();
B2Listener.click = function() {
if (B2.selected) {
B = B2On;
}
else {
B = BOff;
}
Total.text = A + B;
};

//Here I listen for any selections.
//THIS IS WHERE I THINK THE PROBLEM LIVES.
//IT SEEMS TO ONLY LISTEN TO ONE OF EACH GROUP,
//IF YOU SWITCH THE NUMBERS, YOU’LL SEE.
AGroup.addEventListener(“click”, A1Listener);
AGroup.addEventListener(“click”, A2Listener);
BGroup.addEventListener(“click”, B1Listener);
BGroup.addEventListener(“click”, B2Listener);