
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
The Anatomy of an Object
|
277
Note that not all objects represent some physical aspect of a Flash movie. At the end
of this chapter, we’ll show how to implement our multiple-choice quiz using OOP.
We’ll use objects of the Quiz, Question, and QuizGUI classes, of which the first two
are abstract concepts, not physical things, in the movie. Our Quiz class, rather than
bouncing movie clips around the screen, encapsulates all the behaviors of a typical
quiz—adding questions, setting the title, setting the user’s answer for a particular
question, and so on. Even ActionScript itself uses objects to represent intangible
things, such as times, dates, or the formatting applied to a text field.
Finally, bear in mind that ActionScript is quite flexible and does not force OOP on
you. You can use OOP in only part of your program, or you can use it to structure
everything you do. This flexibility can cause confusion for both experienced and new
OOP programmers. Java developers, for example, expect everything in a program to
be built as a class, which is possible, but not required in Flash. New OOP program-
mers, on the other hand, wonder how much OOP they should use to build what they
want to build. In this chapter, we’ll work towards the Java mentality, where every-
thing in a program is represented ...