Hi,

I am doing an application which is using Flex UI and java . I calling the swf as an object embeded in jsp. I want to do a functionality call will I do a browser close.
This functionality was already I have implemented in a button call. So I want to make the javascript to poin to the flex function which is doing this. I have implementd as below,

window.onbeforeunload = function() {
getMyApp("mySwf").cancelFunction();

return "";
}


and ExternalInterface.addCallback("cancelFunction",cancelFunc);

This call to flex functon is working fine for me...
The issue is due to the return statment I am getting an confirm alert asking are you sure to navigate away from thiis page..... The functionality I am doing is cancel transaction function . If the user click OK then every thing is fine. But if he clicks cancel the browser will not get closed but and transaction will also get cancelled which is wrong.
If i remove the return then functionality will not get called as the browser is getting closed before it calls the function.
I tried setimeout also ..but it is not possible to call setTimeout in onbeforeunload
Could somebody help me to fix this either through Javascript or flex