Before we turn our attention to the QuizApp class, let's test the QuizQuestion class. Let's go to the fla file and write some code on the first frame to make an instance of QuizQuestion and display it. Here's how:
var quizQuestion:QuizQuestion = new QuizQuestion(
                 "Who is buried in Grant's Tomb?",

Before you run this, though, temporarily take out the reference to the Document Class in the property inspector, otherwise you'll get an error. This is because our Document Class extends Sprite, and if a Sprite is your Document Class, you're not allowed to have any code on your timeline.

You might not have realized that you're allowed to write code on multiple lines like this. Writing it this way is not necessary, it's just that to me it makes it easier to read. The question is on the first line, the correct answer is on the second line, and the possible answers are on the lines following. Naturally, if you supply a correct answer of "3," you'll want to make sure that the answer you intend to be the correct one is the third one listed, so that it corresponds. Press CTRL-Enter to test the movie. You should get a nicely laid out arrangement of the question and possible answers, complete with clickable radio buttons. Cool, eh?

The QuizQuestion class is completely self-contained, and is a good example of encapsulation. After you build it, you really need never visit the code again or worry about how it works internally. Just give it a question, a number representing the correct answer, and a list of possible answers. It takes care of all the other details of laying it all out on the screen, and storing the user's answer whenever one of the radio buttons is clicked on.

When you're satisfied that it all worked out okay, go ahead and close the running movie. Remove all of the frame code, and reinstate QuizApp as the Document Class in the properties panel.