Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Singleton question

$
0
0
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

Viewing all articles
Browse latest Browse all 5648

Trending Articles