• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

Using different coloured font to indicate correct or incorrect answers

New Here ,
Mar 19, 2016 Mar 19, 2016

Copy link to clipboard

Copied

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.

radio button overwrite.jpg

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.

Views

356

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 20, 2016 Mar 20, 2016

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines