Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function displayScreen(screenClass:Class):void
- {
- // if a current screen exists, remove it
- if (currentScreen != null)
- {
- currentScreen.bringOut();
- }
- // if the screenClass we're told to create is the Game class
- if (screenClass == Game)
- {
- // make it and save it as currentScreen
- // (we need this step because the game needs more than just "this")
- currentScreen = game = new Game(levelXML, this);
- addChild(game);
- game.begin();
- game.bringIn();
- } else {
- // otherwise, just make the screen
- // (this will work with everything else)
- currentScreen = new screenClass(this);
- addChild(currentScreen);
- currentScreen.bringIn();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement