puremvc
|
 |
« Reply #1 on: November 06, 2007, 12:42:38 » |
|
I'm doing a FlashLite game in AS2 with a soon to be released PureMVC port. The game loads multiple levels. The level can be seen as simply registering some new mediators, commands and proxies.
So the shell movieclip initializes the Facade, calling a facade method on its first frame like:
import com.me.mygame.GameFacade; GameFacade.getInstance().startup(this)
A StartupCommand is invoked that does the standard PureMVC housekeeping.
Each level, when loaded, on its frame 1 gets the Facade instance, calls a facade method like:
import com.me.mygame.GameFacade; GameFacade.getInstance().levelLoad(this)
The LevelLoadCommand, like the StartupCommand, gets a reference to the MovieClip that invoked it so it can wrap it in the right Mediator, and create any associated Proxies, register any new commands and send a kickoff notification if necessary.
The idea, then is that the Facade has already been initialized by the shell, and the newly loaded thing just adds what it needs. And if done correctly, the game it will run on its own as well as within the shell.
-=Cliff>
|