This content has been marked as final. Show 5 replies
This works for me....
// Find out whether we came here from the Portal. If so, there will be
// a shared object on disk with the User's data in it.
var so:SharedObject = SharedObject.getLocal("kn.applications.portal.user","/");
if (so.size == 0)
// No shared object.
// Go through standard login.
// Got a shared object.
// Now blat the shared object so that the user
// can't login again after closing this app.
Sorry, I just realised I haven't completely answered your question....
so.clear() will wipe the shared object file, but at the moment I have no idea as to how you would detect the browser closing....
..which begs the question - why do you want to do that? The whole point of a local shared object is to persist after the browser has closed...????
Thanks for the suggestion. The reason I'm hoping using the sol file is to set user session info that can be shared with other Flex apps on the client (in other words to function as a client side session cookie), at least while the session is legit, but then "expire" when the session is over. Would this kind of behavior be possible?
You mention having many flex apps running on the browser in a single session - does that mean you have a single flex app which loads other child apps? Or do you navigate between several apps?
If you have a parent app and you're loading child apps into it (using SWFLoader) then you don't need shared objects to communicate between the apps - there's a proper way of doing it documented here
However, if you navigate between different flex apps, then shared objects seems to be the only way of doing it. However it seems that you won't get a notification when the browser closes, so you won't know that you have to clear the sol file. Does that matter? The file might hang around on your disk but when you log in to the same app again on the same machine I would expect your first app to overwrite the sol file with new data anyway???