Hello,
I am using radio buttons to select a correct answer to a provided question.
This functionality is working fine for me.
Here is what I have in Actionscript 3:
import fl.controls.RadioButtonGroup;
var group:RadioButtonGroup = new RadioButtonGroup ("My Question")
A.group = group;
B.group = group;
C.group = group;
D.group = group;
A.label = "A";
B.label = "B";
C.label = "C";
D.label = "D";
submit.label = "Submit";
submit.addEventListener (MouseEvent.CLICK, submitletter);
function submitletter (event:MouseEvent):void{
if (group.selection == null) {
return;
}
if (group.selection.label == "D") {
correctanswer.text = "Correct!";
mytxt2.text = "Click the blue arrow to go to the next question.";
} else {
incorrectanswer.text = "Incorrect.";
mytxt2.text = "(Remember from Lesson 3, a denominator is a number into which both numerators can divide.";
}
}
My problem is my text field seems to store the first answer I choose, hence if I click another radio button, that text overwrites the existing.
I have created separate text fields in Flash for both "Correct" and "Incorrect".
I am a complete beginner with Flash and I am unsure whether the problem lies with my Flash layout or the my code in Actionscript.
Any suggestions would be appreciated.
Thank you.
Hello,
I have come up with a different and more simple solution for this.
I created 2 different frames, 1 frame with "Correct" in a static textbox and a separate frame with "Incorrect" in a static textbox. I then used gotoAndStop() and chose the appropriate frame number.
There may be a better solution but this option provides me with what I need for now.
Best wishes,
Frank