I'd do something like this:
public function destroy():void{
instance = null;
}
--- In [email protected], Wally Kolcz <wko...@...> wrote:
>
> I want when the user logs out, the instance of the Singleton that
> supports their global information to get set to null. How can you delete
> a Singleton existence or set it to null?
>
> package org.mywindow.model
> {
>
> [Bindable]
> public final class UserDataModel {
>
> private static var instance:UserDataModel;
>
> public function UserDataModel(singletonEnforcer:MySingletonEnforcer) {
> if (singletonEnforcer == null) {
> throw new Error ("UserDataModel is a singleton class, use
> getInstance() instead");
> }
> }
>
> public static function getInstance():UserDataModel {
> if (instance == null)
> instance = new UserDataModel(new MySingletonEnforcer());
> return instance;
> }
> }
> }
>
> class MySingletonEnforcer {}
>
> Thanks!
>