0 Replies - 763 Views - Last Post: 17 December 2014 - 09:32 PM

#1 kurazi   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 35
  • Joined: 27-March 11

Quiz - How to remove movieclip after going back to first frame

Posted 17 December 2014 - 09:32 PM

I have a quiz set so the user selects one of the 3 answers and depending on what they select either a "incorrect feedback" movie clip pops up on screen or the correct feedback. The incorrect movie clip has a button on it that opens another movie clip(an overlay of the whole screen) that has a review for the user to read. After they read it, they click a back button which takes then back to frame one to redo the quiz. However when they go back to frame 1, the incorrect feedback is still on the screen. I tried to do removeChild(feedback) in a bunch of spots including the back button that is on the overlay review, but I still can get it to go away.

The other thing I am trying to figure out is how to make it so the user can only select one answer each time they answer the question. When they first try the quiz I dont want them to be able to choose the wrong answer, and then keep trying to get the right answer without having to read the review part. They can only answer it once first then - if correct then thats it. if it is incorrect, they must read the review pop up.

Any ideas would be great as I am new to as3.

quiz code
var radioGroup1:RadioButtonGroup = new RadioButtonGroup("Question 1");
var feedback:MovieClip;

rb1.label = "A";
rb2.label = "B";
rb3.label = "C";



rb1.group = radioGroup1;
rb2.group = radioGroup1;
rb3.group = radioGroup1;

submit_btn.addEventListener(MouseEvent.CLICK, submitClick);

function submitClick (event:MouseEvent):void {

	if (radioGroup1.selection == null) {		
		return;
	}
	if (radioGroup1.selection.label == "A") {
		radioGroup1.selection.selected = false;
		feedback = new Feedback1();
		feedback.x = 0;
		feedback.y = 201;
		addChild(feedback);
		
	} 
    if (radioGroup1.selection.label == "B") {
		feedback = new Feedback2();
		feedback.x = 0;
		feedback.y = 201;
		addChild(feedback);
		
	} 
	if (radioGroup1.selection.label == "C") {
		feedback = new Feedback5();
		feedback.x = 0;
		feedback.y = 201;
		addChild(feedback);
		
	} 
	
}



back button code that is on the "review" movie clip that takes them back to frame 1

back_btn.addEventListener(MouseEvent.CLICK, goClickMe);

function goClickMe(event:MouseEvent):void {
	MovieClip(parent).gotoAndStop(1);
}


This post has been edited by kurazi: 17 December 2014 - 09:34 PM


Is This A Good Question/Topic? 0
  • +

Page 1 of 1