So i have a little problem, I'm creating a multiple choice quiz in AS3. At the minute the user is free to skip the question by clicking the next question button.
What I'm trying to do is to hide the button and then have it re-appear once the user has clicked the correct answer. I know I'm going wrong somewhere but any help would be massively appreciated.
I've put the code relating to the button in bold to highlight the problem.
Thanks for your time.
Code:stop(); messageBox.text = ""; // Clears the Response box var correctAnswer:String = "2 Minutes"; // Sets correct answer for comparison var userAnswer:String; // with value from radio button group. var rbg:Object = rbtwo.group; // Get the name of the radio button group from the first button. next_btn.enabled = false; next_btn.addEventListener(MouseEvent.CLICK, changeQuestion); btnCheck.addEventListener(MouseEvent.CLICK, checkAnswer); function checkAnswer(evt:MouseEvent):void { userAnswer = String(rbg.selectedData); if (userAnswer == correctAnswer) { messageBox.text = "Yes, " + userAnswer + " is the correct answer!"; next_btn.enabled == true; } else { messageBox.text = "No, " + userAnswer + " is incorrect. Try again."; } } function changeQuestion(event:MouseEvent):void { if (userAnswer == correctAnswer) { next_btn.enabled == true; } else{ next_btn.enabled = false; } } next_btn.addEventListener(MouseEvent.CLICK, next15Click); function next15Click(event:MouseEvent):void { gotoAndPlay(21); };




Reply With Quote
