0

Updated

Trying to create a quiz where you select an answer in a comboBox, hitting a submit button and a dynamic text area telling you if the answer is correct or not.

Cant figure out the proper scripting. The comboBox and button work on their own until I add the action script to the submit button then it just keeps looping.

This is the action script I've tried to use on the submit button: "box" refers to the comboBox "answer" refers the the dynamic text

submitBtn.addEventListener(MouseEvent.MOUSE_UP, submit);

function submit(evt:Event):void{
if (box.getValue() != "65°") {
    answer = "Wrong";
}
else if (box.getValue() == "65°") {
    answer = "Correct";
}   

}

These are the errors im getting

Scene 1, Layer 'submitBtn', Frame 1, Line 4, Column 10 1061: Call to a possibly undefined method getValue through a reference with static type fl.controls:ComboBox.

Scene 1, Layer 'submitBtn', Frame 1, Line 5, Column 12 1067: Implicit coercion of a value of type String to an unrelated type flash.text:TextField.

Scene 1, Layer 'submitBtn', Frame 1, Line 7, Column 15 1061: Call to a possibly undefined method getValue through a reference with static type fl.controls:ComboBox.

Scene 1, Layer 'submitBtn', Frame 1, Line 8, Column 12 1067: Implicit coercion of a value of type String to an unrelated type flash.text:TextField.

Any help would be great

Rob
  • 15
  • 1
  • 6
  • Please write what is your exact question. It seems you just want somebody to make a quiz for you. – Creative Magic May 13 '14 at 04:35
  • your question is still not clear. You want to loop trough questions? How are they stored? XML, in code, in a txt file? Oh, and you don't need so many if() statements, just make an if()else, because, as I understand there can be only 1 correct answer. – Creative Magic May 13 '14 at 11:52
  • on (press) ? that's not Actionscipt 3. You seem to have merged some AS3 code with some AS2 code. – Aralicia May 13 '14 at 13:13
  • Remove the `on(press){` (and trailing brace), that will throw an error . If it still doesn't work, tell us what error you're getting. – BadFeelingAboutThis May 13 '14 at 22:00
  • this is the code I've changed it to – Rob May 13 '14 at 22:30

0 Answers0