Hello and thank you for your time. I have an array which randomly picks 5 frames out of 7, no repeats.
startBtn.addEventListener(MouseEvent.CLICK, startQuiz);
function startQuiz(event:MouseEvent):void{
var number_array:Array = [8158,8159,8160,8161,8162,8163,8164];
var final_array:Array = [];
var count_selected:int = 5;
var i:int;
for(i = 0; i < count_selected; i++)
{
if(number_array.length == 0)
break;
else
final_array.push(number_array.splice(Math.floor(Math.random() * number_array.length), 1)[0]);
}
gotoAndStop(final_array[0]);
}
and when you click on the "startBtn", it takes you to the first randomly generated frame(final_array[0]) and it's all great to start the process randomly.
Each of the next 7 frames has a submit button(b1,b2...b7) which keeps track of the score and submits the answer and also should go to the next randomly picked frame but only 5 times following gotoAndStop(final_array[1]);(final_array[2])....(final_array[3])....(final_array[4]).
b1.addEventListener(MouseEvent.CLICK, quizHandler1)
function quizHandler1(event:MouseEvent):void{
if(mygroup1.selection.label=="B) 12") {
count = count + 20;
scoreresult.text = (count).toString();
gotoAndStop(final_array[1]);
}
else{
gotoAndStop(final_array[1]);
}
}
My problem is...Since the user will only go to 5 randomly picked frames out of 7, how can I make sure all the buttons in all 7 frames will listen and follow the gotoAndStop(final_array[]); statement in the order of 5? Because at the end, 2 frames will be left out, and those two frames will change randomly in every roll. I hope I could explain my dilemma. Thank you again.
Aucun commentaire:
Enregistrer un commentaire