AS3: Browser closing interruption

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: