Yep true, Sorry Aaron I missed the initial email.

Tracys recommendation is simple and perfect for flex web based apps, Air apps 
are another issue.

Could you perhaps hold all state variables in a bindable associative array or 
object, then just rebuild the object? Are you using any recognised framework 
for your app?

________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Aaron 
Hardy
Sent: Friday, 5 December 2008 9:38 a.m.
To: [email protected]
Subject: Re: [flexcoders] Resetting an application's view for new user


Yeah, I think that would be akin to the first option described in my initial 
email.  The difficulty with that is making sure that all state variables really 
do get reset.  If new view combinations are added to the system later, the 
developer is required to ensure they are also included in the reinitialization 
process.  Something that really ensures that everything is at a clean slate and 
doesn't leave room for error on the developer's part would be really nice.  
Tracy's recommendation is great for that since it basically re-loads the SWF 
completely, but I'm not sure there's an AIR-based alternative.

Aaron
On Thu, Dec 4, 2008 at 12:48 PM, Wildbore, Brendon <[EMAIL 
PROTECTED]<mailto:[EMAIL PROTECTED]>> wrote:

If you have an initialisation process which resets all state variables when the 
application starts you could just run that process again?



________________________________

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of Aaron Hardy
Sent: Friday, 5 December 2008 8:22 a.m.
To: [email protected]<mailto:[email protected]>
Subject: Re: [flexcoders] Resetting an application's view for new user



That's a good idea.  I wonder if there's a way to do something similar in AIR 
considering you can't make the AIR executable restart itself (from what I 
know...without a bridge like Merapi).  Maybe there's a way to essentially 
reload the contents of the AIR app without actually re-starting the executable?

Thank you very much for your feedback!

Aaron

On Thu, Dec 4, 2008 at 11:15 AM, Tracy Spratt <[EMAIL PROTECTED]<mailto:[EMAIL 
PROTECTED]>> wrote:

Here is what I do:

  public function logOff():vo id

  {

    var ur:URLRequest = new URLRequest(_sAppUrl);

    navigateToURL(ur,"_self");

  }//logOff



_sAppUrl comes from the browser: location.href



Tracy

________________________________

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>] On 
Behalf Of Aaron Hardy
Sent: Wednesday, December 03, 2008 10:32 PM
To: [email protected]<mailto:[email protected]>
Subject: [flexcoders] Resetting an application's view for new user



Hey flexers,

I have a hefty AIR application with many different view combinations,
forms filled with data, etc. When a user logs out and a different user
logs in, I need the application to be "reset" so that everything looks
as though no other user was previously logged in. I've ran into two
solutions:

1) Reset all the forms, views, etc to their original state when the
first user logs out. This can be tricky getting everything back to its
initial state.
2) Make the main view (what would be the main application file in option
#1) a separate component. When the user logs out, let the whole
component get garbage collected. When the new user logs in,
reinstantiate the main view to ensure its all in its initial state once
again. With this option, there's not as much worrying about whether
you've successfully reset everything since it's a brand new instance.
However, processing time and memory management may be a new issue to
deal with.

So, I'm curious, how do you folks go about this in your projects? Thanks!

Aaron




Reply via email to