Keyboard won't respond


hey,

 

i'm trying familiar whole keyboard event detection thing.

 

here's sample code.

 

<?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"
               creationcomplete="init()">
   
    <fx:script>
        <![cdata[
           
            import flash.events.keyboardevent;
            import mx.controls.alert;
           
            private function init():void{
                addeventlistener(keyboardevent.key_down,reportkeydown);   
            }
           
            private function reportkeydown(event:keyboardevent):void {
                alert.show("a key pressed");
            }
           
        ]]>
    </fx:script>

</s:application>

 

as can see, i'm @ stage 0 of playing around it, won't work. has idea should doing instead?

 

thanks

your code fine.

 

it won't fire event unless has focus on something.

 

add check box

start typing

nothing happen.

 

add check box

click on check box

start typing, , it'll fire event.

 

add check box

click on check box,

move mouse away start typing

it'll still fire event.

 



More discussions in Flex (Read Only)


adobe

Comments

Popular posts from this blog

Christian Home School Programs - Joomla! Forum - community, help and support

Typo in documentation

captcha in coldfusion MX