Quantcast
Channel: Adobe Community : Discussion List - Using Flash Builder
Viewing all articles
Browse latest Browse all 1802

Using different coloured font to indicate correct or incorrect answers

$
0
0

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.


Viewing all articles
Browse latest Browse all 1802

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>