# AS3: Browser closing interruption

**URL:** <https://forum.kirupa.com/t/as3-browser-closing-interruption/217667>\
**Category:** flash\
**Created:** [February 28, 2007, 9:24pm UTC](https://forum.kirupa.com/t/as3-browser-closing-interruption/217667 "2007-02-28T21:24:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwopitz](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jwopitz/32/1556_2.png) [@jwopitz](https://forum.kirupa.com/u/jwopitz)\
**Post date:** [February 28, 2007, 9:24pm UTC](https://forum.kirupa.com/t/as3-browser-closing-interruption/217667/1 "2007-02-28T21:24:10Z")

</div>

Having issues with this AND maybe this isn’t the precise location for this post. But anywhoooooo…:whistle:

I have an AS3 application that utilizes both Local Shared Object and/or server calls to save user preferences. So I want to be able to save when the user closes the browser window. I looked into the javaScript onbeforeunload event and that works great except I have to use an js alert to pause the closing mechanism.

What I would like to do is this:[LIST=1]  
[_]user initiates a browser close  
[_]onbeforeunload calls a js function  
[_]js will see if a boolean is false, if so then calls swf function to save prefs, else will close browser  
[_]swf function onSuccess or onFail will talk back to another js function  
[_]js function2 will set boolean to true and call js function 1  
[_]js function1 will see that things are saved and closes[/LIST]Am I asking too much from js? too much from AS3? :stare:
