ASAP Movie Management
One of the fundamentals of ASAP Framework is the Object Oriented way of loading and managing external movies. This page describes how to use ASAP to create multipage sites.
Most Flash projects consist of more than one movie, with clear benefits: users do not have to download one megafile; designers and developers can divide their work better. Out of the box, Flash does not offer much help in managing separate movies, leaving developers on their own. Each developer might find a best way of doing this, but the end result will be different each time: some movies will start before being loaded, some movies will start only after hitting a page refresh. And the lack of rules becomes a maintainance nightmare for development teams.
ASAP Framework offers two basic principles that make movie management consistent and controllable:
- Each separate movie is controlled by a specialized subclass of LocalController
- The specialized controller only knows about the SWF it controls: the data it needs, the interface elements on the stage.
- Each movie is loaded through MovieManager
- All loaded movies can be accessed through MovieManager, although in practice almost all communication happens through events. Because
MovieManager is a singleton, it can be accessed from every part.
The premise is fundamental OO: each part in the project only knows as much as it should, and nothing more. Good programming practice is the top down approach: lower level (more specialized) objects talk to their environment by sending out events. Higher level objects subscribe to lower level events and deal with these as they occur.
See Access to the controller from lower classes to see how lower level interface elements can access their LocalController.
This schema illustrates how movie handling is done:
The main movie controller (often called
AppController) orders
MovieManager to load a new movie. Once the movie has been loaded and its
LocalController initialized,
MovieManager sends out a
MovieManagerEvent (
onMovieReady) passing the local
LocalController with the event.
In more detail:
The
Simple Application Demo shows how to use this in practice.