Equal variables

hi, i’ve started to make like a quiz in flash with 218 questions in it! i’ve made it so the computer will show X amount of random questions.i’ve already got the code on the buttons so it will jump to a random question, but i’m having trouble with limiting the number of questions asked.

i’ve got an inputbox so the user can chose how many questions they do and the buttons add 1 each time thier pressed to a different [color=#003366]variable.[/color]
[color=#003366][/color]
[color=#003366]i’ve got this code, but it never seems to stop asking questions[/color]
[color=#003366][/color]
on (release) {
score = score+0;
page = page+1
if( (page == pagemax) )
GotoAndStop(220)
if( (page != pagemax) )
myVariable = random(219); //creates a random number between 0 and 5
if (myVariable < 2){ //checks to see if it’s value is zero
myVariable = 2; //set it to 1 if it is zero
}
gotoAndStop(myVariable); //goes to and plays the frame.
}

what i need is so when page (the number of questions asked) is equal with pagemax (how many questions the user wants to do) it will goto and stop on frame 221

thanks for any help