flex-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark goldin <markzolo...@gmail.com>
Subject Singleton question
Date Thu, 13 Nov 2014 19:33:20 GMT
Here is my singleton:
[Bindable]
public class ModelLocator extends EventDispatcher implements IModelLocator
{
private static var _instance:ModelLocator = new ModelLocator();
public var test:String;

public function ModelLocator()
{
if (_instance != null){
throw new Error("You can have only one ModelLocator");
}
}
 public static function getInstance():ModelLocator
{
 return _instance;
}
 }
}

When I am debugging I see that _instance is always different object when I
get an instance of my singleton. Is that right?

Thanks

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message