This will not change anything, still will be many times instantiated
"singleton" as in my example. Scope control is just to prevent funny
guys doing something like var Vasya = new DataManager();

--- In flexcoders@yahoogroups.com, "Rick Winscot" <[EMAIL PROTECTED]>
wrote:
>
> I just looked at your source. You forgot to control the scope! Your
> implementation should be:
> 
> package
> {
>       public class DataManager
>       {
>               private static var singleton_:DataManager = new
> DataManager();
> 
>               public function DataManager( enforcer:SingletonEnforcer ) {
> }
>               
>               public static function getInstance():DataManager {
> 
>                   if ( singleton_ == null )
>                   singleton_ = new DataManager( new SingletonEnforcer );
> 
>                   return singleton_;
>               }               
>       }
> }
> 
> class SingletonEnforcer{}
> 
> 
> If you do this... it doesn't/won't matter where you instantiate it.
There
> can be only one - MUWUAHAHAHAA.
> 
> 
> Rick Winscot

Reply via email to