Detect browser close or redirection

Hi,
Would like to know if there is a way to detect if the user closes the browser that the swf is in or just detect when he or she leaves the same swf.
I need that to update some information, in this case, a logoff or logout situation.
Everything in AS2.
:slight_smile:

THANKS!

Leo.