stop(); var questionAns = new Array('', 'yes', 'yes', 'yes', 'yes', 'yes'); var ans:String; var questionNO:Number = 1; var ansCorrect:Boolean; _parent.ansHistory = new Array(); function PlayWang(str) { mc_littlewang.gotoAndStop(str); mc_oldwang.gotoAndStop(str); } function CheckAns(a_ans) { hint_mc._visible = false; var correctAns = questionAns[questionNO]; mc_submit._visible = true; if (a_ans == correctAns) { _parent.userScore += 20; mc_message.nextFrame(); PlayCorrectSound(); ansCorrect = true; mc_congratuation._visible = true; PlayWang('happy'); mc_ansHint1.gotoAndStop('correct'); //_global.setTimeout(GotoNext,1000); } else { ansCorrect = false; PlayErrorSound(); PlayWang('sad'); if (correctAns == 'yes') { mc_ansHint1.gotoAndStop('correct'); mc_ansHint2.gotoAndStop('error'); mc_ansHint3.gotoAndStop('error'); mc_ansHint4.gotoAndStop('error'); } else { mc_ansHint1.gotoAndStop('error'); mc_ansHint2.gotoAndStop('error'); mc_ansHint3.gotoAndStop('error'); mc_ansHint4.gotoAndStop('error'); } } } function PlayCorrectSound() { var my_sound:Sound = new Sound(); if(_parent.userScore==100) { my_sound.attachSound("happyending"); } else { my_sound.attachSound("rightsound"); } my_sound.start(); } function PlayErrorSound() { var my_sound:Sound = new Sound(); my_sound.attachSound("wrongsound"); my_sound.start(); } function GotoNext() { mc_congratuation._visible = false; if(ansCorrect) { this['mc_history'+questionNO].gotoAndStop(2); } else { this['mc_history'+questionNO].gotoAndStop(3); } _parent.ansHistory.push(ansCorrect); mc_submit._visible = false; hint_mc._visible = true; questionNO++; mc_ansHint1.gotoAndStop(1); mc_ansHint2.gotoAndStop(1); mc_yes.Reset(); mc_no.Reset(); if (questionNO>=questionAns.length) { _parent.gotoAndStop("result"); } else { gotoAndStop(questionNO); } mc_yes.enabled = true; mc_no.enabled = true; } mc_yes.onRelease = function() { this.Disabled(); mc_no.enabled = false; CheckAns('yes'); }; mc_no.onRelease =function() { this.Disabled(); mc_yes.enabled = false; CheckAns('no'); }; mc_submit.onRelease = function() { //ansCorrect = false; GotoNext(); }; mc_congratuation._visible = false; mc_submit._visible = false;