Not much to say directly on the code:
public class ViewManager
{
static private var instance:ViewManager;
static public function get Instance():ViewManager
{
if(instance == null){
instance = new ViewManager();
}
return instance;
}
}
Code Description:
- Create a public class: ViewManager
- Declare a private static variables: instance (type is a class ViewManager)
- When you first create ViewManager of, instance == null, direct new
- After the second until, instance! = Null, direct return instance
External direct invocation:
ViewManager.Instance.aa();