I need to reset, clear or deselect a group of radio buttons
i haven't been able find answer this: have quiz-like animation uses group of radio buttons, need group reset, clear or deselect previous selection after submitting answer on each question, possible?
here code:
stop();
var messagebox:textfield = new textfield();
messagebox.text = "";
addchild(messagebox);
messagebox.textcolor = 0xff0000;
messagebox.width = 200;
messagebox.height =100;
messagebox.x = 450;
messagebox.y = 340;
var useranswer:int;
var rbg:object = rba.group;
var finalscore:int;
btncheck.addeventlistener(mouseevent.click, nextbtn);
function nextbtn(evt:mouseevent):void {
useranswer = int(rbg.selecteddata);
if(useranswer == 0) {messagebox.text = "please select option";
}else{
finalscore = finalscore + useranswer;
messagebox.text = "";
nextframe();
}
}
btnfinish.addeventlistener(mouseevent.click, finishbtn);
function finishbtn (evt:mouseevent):void {
useranswer = int(rbg.selecteddata);
if(useranswer == 0) {messagebox.text = "please select option";
}else{
finalscore = finalscore + useranswer;
if (finalscore > 13){ gotoandstop(8);
}else if (finalscore > 9){ gotoandstop(7);
}else if (finalscore > 4){ gotoandstop(6);
}else {}
}
}
startover.addeventlistener(mouseevent.click, restart);
function restart(evt:mouseevent):void {
gotoandstop(1);
finalscore = 0;
}
yes, radiobuttons have selected property can assign false clear checkmark.
More discussions in ActionScript 3
adobe
Comments
Post a Comment