Here's a simple example. Note that if you don't "own" the window your flash is running in -- you opened it with window.open(...) -- this code will again prompt the user if they really want to close the window in IE, or do nothing (Firefox, chrome, etc).
There are ways around that, but I can't bring myself help others be evil. ;-) Anyway: -------------------------------------------------- in the flash: import flash.external.ExternalInterface; function onUserConfirmedTheyWantToExit():void { ExternalInterface.call("closeWindowAsync", "") ; } in the HTML page <script type="javascript"> function closeWindowAsync() { setTimeout("closeWindowCallback()", 500) ; } function closeWindowCallback() { window.close() ; } </script> ------------------------------------ The use of setTimeout in the javascript is there because of some problems we had calling "window.close" directly in IE6 (very weird IE-locking bugs if there were other browser windows open). Jer On Fri, Aug 7, 2009 at 8:38 AM, <it...@aol.com> wrote: > > Hello, > How to Exit/Close the Web Browser from Flash Applications? > Could anyone suggest a code to exit the flash application and close the > web browser window? > I realize, the solution might be using ExternalInterface with JS. The > question is how? > The user can exit the flash application by clicking on an exit button or > he/she can click on the Window “X”. > When clicking either on the “exit” button or on the Window “X”, the > flash application will show an alert message, asking the user whether > he/she > really want to exit. Upon clicking “yes” the application and web browser > will close. > Therefore, when the user clicks on the Window “X” the flash application > needs to detect this click. > Thanks, > Daniel Abramovich > **************A Good Credit Score is 700 or Above. See yours in just 2 easy > steps! > ( > http://pr.atwola.com/promoclk/100126575x1222846709x1201493018/aol?redir=http://www.freecreditreport.com/pm/default.aspx?sc=668072&hmpgID=115&bcd > =JulystepsfooterNO115) > _______________________________________________ > Flashcoders mailing list > Flashcoders@chattyfig.figleaf.com > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders > _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders