Skip to content

Instantly share code, notes, and snippets.

@iammerrick
Created January 4, 2011 22:54
Show Gist options
  • Save iammerrick/765613 to your computer and use it in GitHub Desktop.
Save iammerrick/765613 to your computer and use it in GitHub Desktop.
Referencing the stage from inner classes. Singleton method.
package
{
import flash.display.MovieClip;
import Pages;
public class Main extends MovieClip
{
public static var instance:Main;
public function Main()
{
instance = this;
var pages = new Pages();
}
static public function getInstance()
{
// Beause this is base class, a new Main should never really be created.
if(instance == null) instance = new Main();
return instance;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment