Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

if/else question 1

Status
Not open for further replies.

Flashoid

Technical User
Dec 11, 2002
163
US
I have a submit button with an input text field in which the user enters an answer. If they answer correctly I have a telltarget telling a movieclip called "score" to advance one frame. The idea is once the playhead advances the correct number of times it displays a "Congrats" message. However, the way it works now it advances the playhead if they push the Submit button more then once after they correctly answer the question. Is there a way to script this so it only advances the playhead once after they press submit once with the correct answer and not advance it again after clicking it once? (the correct answer is "one")

on (press) {
if (answer.text == "one") {
message.text = "Correct! Select next question.";
tellTarget ("../score") {
nextFrame();
}_root.grid_mc.ph_mc.nextFrame();
_root.grid_mc.ph_mc.ph_btn.enabled = false;
} else if (answer.text == "one") {
message.text = "Correct! Select next question.";
_root.grid_mc.ph_mc.nextFrame();
_root.grid_mc.ph_mc.ph_btn.enabled = false;
} else if (answer.text == "ONE") {
message.text = "Correct! Select next question.";
_root.grid_mc.ph_mc.nextFrame();
_root.grid_mc.ph_mc.ph_btn.enabled = false;
} else {
message.text = "Incorrect. Try again or skip.";
}
}
 
I've tried adding submit_button.enabled = false; in various places in the code but I get this error:

**Error** Symbol=input_mc, layer=input, frame=2:Line 3: Syntax error.
submit_button.enabled = false;




Can you tell me where/how I would put the button disable code so it disables the submit button once?

thanks!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top