Skip to content

Instantly share code, notes, and snippets.

@rsattar
Created October 5, 2011 23:59
Show Gist options
  • Save rsattar/1266104 to your computer and use it in GitHub Desktop.
Save rsattar/1266104 to your computer and use it in GitHub Desktop.
How to check if the Adobe security panel is closed
// This code checks one time if the security panel is closed.
// When you open the security panel, you should run this test
// repeatedly with a timer (every 500ms seems to work well).
// If the security panel is closed, you can then clean up your timers
protected function securityPanelIsClosed():Boolean
{
// Why not just wait for an event from the SettingsPanel to know that it's closed?  Because there isn't one.
// See http://bugs.adobe.com/jira/browse/FP-41
var closed:Boolean = true;
var hack:BitmapData = new BitmapData(1,1);  
try 
// Trying to capture the stage triggers a Security error when the settings dialog box is open. 
hack.draw(stage); 
catch (error:Error) 
closed = false; 
}
hack.dispose(); 
hack = null;
return (closed);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment