views:

58

answers:

1

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 ctrl key. Why it happens? how can i catch the KEY_UP for 'c' key?

+1  A: 

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>
Eugene