With ExternalInterface.call you can inject JavaScript into the wrapper document.
if ( ExternalInterface.available ) { ExternalInterface.call('alert("TEST")'); } A good example of what your talking about is here thanks to Greg Jessup http://gregjessup.com/flex-3-catch-browser-exit-or-close-event-using- javascript-and-externalinterface/