package scriptFiles
{
public class Singleton
{
private static var INSTANCE : Singleton
public function Singleton(enforcer:SingletonEnforcer)
{ // construction }
private static function getInstance(): Singleton
{
if(INSTANCE == null)
{
INSTANCE = new Singleton(new SingletonEnforcer());
}
return INSTANCE;
}
}
}
/*
* Constructor
* Dummy private class to enforce Singleton.
*/
class SingletonEnforcer{}
Singleton Implementation in flex
January 13, 2008 by Giri
Hey man,
How will you hadle multi threading here? I dont know much about FLEX but i dont think this code will work if you have multi threaded application.
Correct me if I am wrong?
cheers!