
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
But How Do I Apply OOP?
|
19
bytecode—instructions that the Flash Player can understand and execute. If a class
contains errors, compilation fails and the Flash compiler displays the errors in the
Output panel in the Flash authoring tool. The error messages, such as the datatype
mismatch error described earlier, should help you diagnose and solve the problem.
Even if the movie compiles successfully, errors may still occur while a program is
running; these are called runtime errors. We’ll learn about Player-generated runtime
errors and program-generated runtime errors in Chapter 10.
Starting an Objected-Oriented Application
In our brief overview of OOP in Flash, we’ve seen that an object-oriented applica-
tion is made up of classes and objects. But we haven’t learned how to actually start
the application running. Every Flash application, no matter how many classes or
external assets it contains, starts life as a single .swf file loaded into the Flash Player.
When the Flash Player loads a new .swf file, it executes the actions on frame 1 and
then displays the contents of frame 1.
Hence, in the simplest case, we can create an object-oriented Flash application and
start it as follows:
1. Create one or more classes in .as files.
2. Create a .fla file.
3. On frame 1 of the .fla file, add code that ...