Resetting the ModelLocator
The application that I am currently working on requires the ability for a user to log out of the application. Logging out should effectively reset the entire state of the application back to what it was when the user first showed up to the login page. The best solution would be to to just refresh the browser, but that is not an option. I need the ability to reset the ModelLocator so that all of the views that bind to it revert back to the login state. I can create a reset() function on ModelLocator and manually reinstantiate each property, but I'm looking for a better solution. Since ModelLocator is a singleton, the static constant "_instance" (along with the "locked" constructor - forcing the user to use getInstance to get a reference) can only refer to one instance of ModelLocator. I first tried a public reset function that would call the constructor and pass in the reference to the "key" (private function key), which I was hoping would reinstantiate the static constant "_instance" and therefore force all the views to rebind. However, "_instance" does have a reference to a fresh instance, but any views that have stored a reference to ModelLocator ([Bindable]private var model:ModelLocator = ModelLocator.getInstance();) will NOT get these bindings triggered. This is because that "private var model" is still holding a reference to the FIRST ModelLocator instance that was created. Is there a way to accomplish what I am after, or am I forced to manually reset each property on ModelLocator?
