
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Building a Multiple-Choice Quiz
|
23
The finished .fla file for this quiz can be found in the online Code Depot, cited in the
Preface. This is a lesson in Flash programming, not Flash production. I assume that
you are already comfortable creating and using buttons, layers, frames, keyframes,
and the Text tool. If not, consult the Flash Help documentation. The quiz shows a
real-world application of the following aspects of ActionScript programming:
• Variables
• Controlling the playhead of a movie with functions
• Button event handlers
• Simple conditionals
• Text field objects used for on-screen display of information
Quiz Overview
Our quiz, part of which is shown in Figure 1-4, will have only two questions. Each
question comes with three multiple-choice answers. Users submit their answers by
clicking the button that corresponds to their desired selections. The selections are
recorded in a variable that is later used to grade the quiz. When all the questions
have been answered, the number of correct answers is tallied, and the user’s score is
displayed.
Building the Layer Structure
When building Flash movies, it’s important to organize your content into manage-
able divisions by keeping different content elements on individual layers. Layering
content is a good production technique in general, ...