In general in Cairngorm you maintain state in the model and have the
view listen to changes to the state and react accordingly. So add a
variable to your model locator loggedIn:Boolean. Then have your login
screen listen to changes in the variable either via a ChangeWatcher
or Binding, and clear the controls when it goes false.
--- In cairngorm-devel@yahoogroups.com, "malik_robinson"
<Malik_Robinson@...> wrote:
>
> Hi,
>
> I have a class called LogoutCommand.as, code snippet below:
>
> public class LogoutCommand implements ICommand {
>
> public var modelLocator:ViewModelLocator =
> ViewModelLocator.getInstance();
>
> public function LogoutCommand() {
>
> }
>
> public function execute(event:CairngormEvent):void {
>
> modelLocator.workflowState = ViewModelLocator.LOGIN_SCREEN;
> modelLocator.loginBoxMessage = "You have been logged out!";
>
> }
>
>
>
> }
>
> The above code works fine, but when the screen changes back to the login
> screen, the username and password fields are still filled in with the
> users' original entries.
>
> On logout, I would like those fields to be cleared. I am unsure
on how
> I would access the fields from my Command Class. The syntax should be
> simple, I think I am struggling with "accessibility" and knowing how to
> interact with an object in a different file or whatever...
>
> On my "LoginScreen.mxml" file I have this control: <mx:TextInput
> id="username" width="180"/> I should be able to set its text or value
> property to empty string or something, just not sure how to do that from
> the Command Class if that makes sense.
>
> Any help appreciated...
>
> -
>