Flash Player on IE fails to take CTRL + keyCode
♥2 |
Line 16 |
Modified 2009-10-01 21:29:13 |
MIT License
archived:2017-03-04 22:04:25
ActionScript3 source code
/**
* Copyright 9re ( http://wonderfl.net/user/9re )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/4dfy
*/
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
<mx:Script>
<![CDATA[
// flash player on ie cannot take ctrl + keycode
// the default short cut key events of ie
// seem to rob the flash player of key focus
// check if you can take ctrl + Z, for example
//
// ieのflash playerでコントロール系のキーが取れない
// ieのデフォルトのショートカットキーイベントが
// どうもFlash Playerから
// キーフォーカスを奪ってしまうみたい
// ctrl + Zが取れるかどうか試してみると分かります
import flash.events.KeyboardEvent;
private function onKeyDown(e:KeyboardEvent):void {
log.text = "KeyDown: " + ((e.ctrlKey) ? "Ctrl + " : "") + ((e.altKey) ? "Alt + " : "") + ((e.shiftKey) ? "Shft + " : "") + String.fromCharCode(e.keyCode) + "(code: " + e.keyCode + ")";
}
private function onKeyUp(e:KeyboardEvent):void {
log.text = "KeyUp: " + ((e.ctrlKey) ? "Ctrl + " : "") + ((e.altKey) ? "Alt + " : "") + ((e.shiftKey) ? "Shft + " : "") + String.fromCharCode(e.keyCode) + "(code: " + e.keyCode + ")";
}
]]>
</mx:Script>
<mx:TextArea id="main" width="100%" height="80%" keyDown="onKeyDown(event);" keyUp="onKeyUp(event);"/>
<mx:Text id="log" />
</mx:Application>