[Flash 8]: Help with variables for score counting

I am creating a simple game where you must remember the name of a number of people. On the stage is a table with faces. Text appears, asking who, for example, “Mike” is. You then have to click the correct face. The questions appear randomly.

I have come this far, but what I want to do is the following:

  1. Restrict the number of random questions, presumably by adding a variable, with the value incrementing by each question, and tells the movie clip to go to the “game results” frame when reaching a certain number.

  2. Keep track of the number of questions answered correctly/incorrectly. I suppose this is also done easily by adding a value for number of incorrect answers, which is increased for each incorrect answer, with the amount of correct answers being calculated like (total number of questions)-(incorrect answers).

  3. Display the number of correct and incorrect questions on the “game results” frame. For example “You answered X number of questions correctly, and Z number of questions incorrectly”.

I know that the pieces of code below should be used, but I don`t know how to put it all together, or where to put it. I suppose the main code should be in the first frame, and some should be in the buttons.

var questionsAsked:Number;
myValue++;
 if (questionsAsked == 20){ 
gotoAndStop("results");
}

It would be great if I could get help with this.