Here's an easier version of the singleton class - similarly used in the Caingorm framework for AS3. The key is that the constructor is void and doesn't allow instantiation of itself
Code:
package com.layeronemedia {
/**
* One-Instance enforced singleton that instantiates and contains the data
* as a DataCollection and the controls as the ControlCollection.
*/
public class Controller {
private static var _instance:Controller;
/**
* Public static method to instantiate the Controller object.
* @return Controller Object Instance
*/
public static function getInstance():Controller {
if (_instance == null) {
_instance = new Controller();
}
return _instance;
}
public function Controller():void {
_Do all your Stuff Here
}
}
}