Game Development Reference
In-Depth Information
Figure 12-7.
Placement of the soundHolder clip on the main time line
Framework Changes for Flash IDE preloading
We will be making some significant changes to the
com.efg.framework
and
Main.as
class
structure to add preloading to the IDE-based
Main.as
document class. Unlike the Flex SDK
preloader, the Flash IDE-based preloader will not require a separate
Preloader
class. We will
need to add in a new state to the
Main.as
state machine though. We did not need to do this for
the Flex SDK preloader.
Note: We will cover the entire Tunnel Panic
Main.as
code listing in the section called "Creating
the
Main.as
for Tunnel Panic". What follows are just the additions to the Chapter 11
Main.as
and
the
com.efg.framework
classes to support the new preload and Mochi functions.
Adding in the new Flash IDE preloader state to the framework
We need to make some changes to
com.efg.framework
classes
to support preloading with the
Flash IDE. Flex SDK users should also follow along as some of the changes will also be needed
to support that development environment.
First, we need to add some states. In the variable definition section of the
FrameWorkStates.as
class, we will need to add new constants for the preloading. We have also added constants for
Mochi ads and leader boards that will be covered in the next section. Add the following lines to
the constants definition section. Note that Flex SDK users do not need the
STATE_SYSTEM_PRELOAD
state, but they should add it to the
FrameWorkStates.as
in case they will use the framework with
the IDE at a later date.