Forum ActionScript 3.0 Keyboard Listener not working

Problems and discussions relating to ActionScript 3.0 here.

Keyboard Listener not working

Postby sger » October 26th, 2012, 9:24 am

Hello,

i'm using the following code

stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyboardDown);

private function onKeyboardDown(event:KeyboardEvent):void
{
mConnection.send("key", event.keyCode);
}

connection.addMessageHandler("key", function(m:Message, userid:String, key:String){
textfield.appendText("key userid --->" + userid + " " + key);
})

but i cant get keycodes any help?
sger
 
Posts: 2
Joined: October 25th, 2012, 11:49 am

Re: Keyboard Listener not working

Postby dreamora » October 26th, 2012, 10:54 am

Check the Flash documentations. There are a few major limitations for keyboard input handling in Stage 3D that you must comply to
dreamora
 
Posts: 225
Joined: March 2nd, 2012, 9:58 am

Re: Keyboard Listener not working

Postby sger » October 26th, 2012, 11:15 am

the project is not stage3d any example on this
sger
 
Posts: 2
Joined: October 25th, 2012, 11:49 am

Re: Keyboard Listener not working

Postby Benjaminsen » October 29th, 2012, 3:01 pm

Add a trace inside onKeyboardDown to verify that the key event is actually fired.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to ActionScript 3.0