Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public function displayScreen(screenClass:Class):void
  2. {
  3.     // if a current screen exists, remove it
  4.     if (currentScreen != null)
  5.     {
  6.         currentScreen.bringOut();
  7.     }
  8.    
  9.     // if the screenClass we're told to create is the Game class
  10.     if (screenClass == Game)
  11.     {
  12.         // make it and save it as currentScreen
  13.         // (we need this step because the game needs more than just "this")
  14.         currentScreen = game = new Game(levelXML, this);
  15.         addChild(game);
  16.         game.begin();
  17.         game.bringIn();
  18.     } else {
  19.         // otherwise, just make the screen
  20.         // (this will work with everything else)
  21.         currentScreen = new screenClass(this);
  22.         addChild(currentScreen);
  23.         currentScreen.bringIn();
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement