Computer Science Canada

How can i use the keyboard in flash

Author:  nis [ Tue Mar 09, 2004 4:31 pm ]
Post subject:  How can i use the keyboard in flash

How do i make the computer reconize when the 'a' button is pressed or 'b' etc. I know how to use the arrow keys (Key.UP, Key.DOWN, etc) but how do i use the other keys? thanks

Author:  Tony [ Tue Mar 09, 2004 5:16 pm ]
Post subject: 

well the same way as Key.UP/DOWN, but instead you might have to use their ASCII values Confused

Author:  zylum [ Tue Mar 09, 2004 8:20 pm ]
Post subject: 

yeah tony is right, you need to use ascii. here's a simple way to check what the ascii value of the last letter you pressed:

code:
onEnterFrame = function () {
        // checks if a is being pressed
        // if (Key.isDown(65)) {
        // trace("fun");
        // }
       
        // gives you the keyCode for the last letter you pressed
        trace(Key.getCode());
};


-zylum

Author:  nis#2 [ Thu Mar 11, 2004 5:04 pm ]
Post subject: 

Thanks


: