I am trying to capture Ctrl+C.
I have noticed that many times, th开发者_如何学Pythonere 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?
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>
精彩评论