code_junkie

Flex/AIR: automatically absorb unassigned/disabled key shortcuts

Nov 11th, 2011
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. public var OperatingSystem:String = !!NativeApplication.supportsDockIcon ?
  2. 'mac' :
  3. !!NativeApplication.supportsSystemTrayIcon ?
  4. 'win' :
  5. 'other';
  6.  
  7. stage.addEventListener('keyDown', function(e:KeyboardEvent):void {
  8. if(e[(OperatingSystem == 'mac' ? 'commandKey' : 'ctrlKey')]) {
  9. e.preventDefault();
  10. }
  11. });
Add Comment
Please, Sign In to add comment