• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 12. Objects and Classes > The Multiple-Choice Quiz, OOP Style

12.12. The Multiple-Choice Quiz, OOP Style

Now that you understand the principles of OOP, let's return to our multiple-choice quiz example to see them in action. The source code for our OOP quiz is too long to present here, but it can be downloaded from the Code Depot. The important part of the application is its object design, listed next. Even without seeing the code in the quiz, the following tables—which describe the classes, methods, properties, and events in the quiz—should give you a complete picture of how the application works. In fact, using the following structure, you may want to try to build the quiz yourself before you download its source code. Note that some properties are not listed in the tables, because they are used by a class's methods only, and they are therefore considered internal ("private") to the class.

Our quiz comprises three classes, shown in Table 12-2. The entire quiz is generated from ActionScript—there's not a single asset in the movie's Library. All buttons are drawn with the Drawing API, and all text is created with MovieClip.createTextField( ), giving the quiz a flexible layout that adapts to the current Player size, question length, and answer length. Navigation buttons—Next, Back, Grade, and Try Again—let the user proceed nonlinearly through the quiz, change an existing answer, be graded, or retry the quiz.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint