KEY_UP event of ctrl key blocks KEY_UP event of 'c' key

十年热恋 提交于 2020-01-13 05:59:47

问题


I am trying to capture Ctrl+C.

I have noticed that many times, there is no KEY_UP event for C key. I believe it happens in cases KEY_UP event for C key should be thrown just before or after KEY_UP event for Ctrlkey.

Why does this happen? How can I catch the KEY_UP for C key?


回答1:


Everything works fine:

    <?xml version="1.0" encoding="utf-8"?>
< s:Application xmlns:fx="http://ns.adobe.com/mxml/2009" 
               xmlns:s="library://ns.adobe.com/flex/spark" 
xmlns:mx="library://ns.adobe.com/flex/mx">

<fx:Script>
    <![CDATA[
        protected function myButton_keyUpHandler(event:KeyboardEvent):void
        {
            myButton.label="";
            if(event.ctrlKey)
                myButton.label+="Ctrl-";
            if(event.altKey)
                myButton.label+="Alt-";
            myButton.label+=String.fromCharCode(event.keyCode)
        }
    ]]>
</fx:Script>



<s:Button id="myButton" keyUp="myButton_keyUpHandler(event)" />


</s:Application>


来源:https://stackoverflow.com/questions/3568907/key-up-event-of-ctrl-key-blocks-key-up-event-of-c-key

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!