# \[FMX\] How to perform a "destructor" like action when browser window is closed

**URL:** <https://forum.kirupa.com/t/fmx-how-to-perform-a-destructor-like-action-when-browser-window-is-closed/37030>\
**Category:** flash\
**Created:** [December 4, 2003, 11:06pm UTC](https://forum.kirupa.com/t/fmx-how-to-perform-a-destructor-like-action-when-browser-window-is-closed/37030 "2003-12-04T23:06:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![potamus](https://avatars.discourse-cdn.com/v4/letter/p/4bbf92/32.png) [@potamus](https://forum.kirupa.com/u/potamus)\
**Post date:** [December 4, 2003, 11:06pm UTC](https://forum.kirupa.com/t/fmx-how-to-perform-a-destructor-like-action-when-browser-window-is-closed/37030/1 "2003-12-04T23:06:45Z")

</div>

I have a chat program built using flash for the front end tied to a J2EE back end. My program creates socket connections which must be closed appropriately when a user signs off.

When a user decides to sign off they can click the sign off button and everything is peachy. However, a less responsible user may choose to sign off by simply killing the browser window. Is there any way to implicitly call an actionscript routine on this event?

Thanks!

potamus.
