/ Published in: ActionScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
package { [Bindable] public class MainModel { private static var _instance:MainModel = new MainModel(ModelEnforcer); public static function getInstance():MainModel { return _instance; } public function MainModel(enforcer:Class) { if(enforcer != ModelEnforcer) { throw new Error("Use MainModel.getInstance to access model"); } } } } class ModelEnforcer {}