Update : flex 4 solution
So, when I switched to flex 4 and started compiling my mxml with the open source mxmlc compiler, the solution below did not work because the warning does not lose focus when you are already in the settings.
As far as I could tell, I had to move to a less elegant solution, when the user had to click "OK" in the warning window every time they were done with the settings.
Here is the new code:
private function setup_smart_hide():void {
alert = Alert.show('Click "OK" to continue.', 'Thanks!', Alert.OK, null, function(e:CloseEvent):void {
hide_self();
});
}
OLD: (flex 3) Got this job ...
private function setup_smart_hide():void {
alert = Alert.show('Thanks');
alert.addEventListener(FocusEvent.FOCUS_IN, function(event:FocusEvent):void {
ExternalInterface.call("SB.flex.hide");
});
alert.addEventListener(FocusEvent.FOCUS_OUT, function(event:FocusEvent):void {
ExternalInterface.call("SB.flex.show");
});
alert.setFocus();
}
init()... (, ), focusOut , flex .