0

因此,一旦执行操作,我需要显示文本,但即使我尝试使用动态文本和标签来这样做,由于错误,我没有设法完成我的编程:

var group:RadioButtonGroup= new RadioButtonGroup ("Question1");
var group2:RadioButtonGroup= new RadioButtonGroup ("Question2");
var group3:RadioButtonGroup= new RadioButtonGroup ("Question3");
var group4:RadioButtonGroup= new RadioButtonGroup ("Question4");
var group5:RadioButtonGroup= new RadioButtonGroup ("Question5");
var counterT:int;
var counterF:int;

submit.buttonMode=true;
counterT=0;
counterF=0;

t1.group = group;
f1.group = group;

t2.group=group2;
f2.group=group2;

t3.group=group3;
f3.group=group3;

t4.group=group4;
f4.group=group4;

t5.group=group5;
f5.group=group5;

submit.label="Submit";
submit.addEventListener(MouseEvent.CLICK,submitanswer); 

function submitanswer (event:MouseEvent): void {
    if (group.selection == t1)  {
        counterT==counterT+1
    }
    else 
    if (group.selection==f1) {
        counterF==counterF+1;
    }
}
if (group2.selection ==t2) {
    counterT==counterT+1
}
else
if (group2.selection==f2) {
    counterF==counterF+1
}
if (group3.selection ==t3) {
    counterT==counterT+1
}
else
if (group3.selection==f3) {
    counterF==counterF+1
}
if (group4.selection ==t4) {
    counterT==counterT+1
}       
else
if (group4.selection==f4) {
    counterF==counterF+1
}
if (group5.selection ==t5) {
    counterT==counterT+1
}       
else
if (group5.selection==f5) {
    counterF==counterF+1
}
4

1 回答 1

1

我看到的第一件事是您正在使用==来设置一个值。=设置值时需要使用。所以像这样:

if (x == y) {
    counter = counter + 1;
}

或者你可以counter++像这样使用

if (x == y) {
    counter++;
}
于 2016-05-12T21:08:44.160 回答