[Resolved]troubles with keyboard handler


I try to make some things with keyboard buttons. But my program never go into keyDown:function and keyUp:function.
In my layer’s init I make this.setKeypadEnabled(true);
Also I create in layer
But when I put brealpoint in keyDown:function - nothing. Help me, please!



we found a BUG in CCDirector.js
if yuo have troubles with this, edit CCDirector.js according to this:
this.*keypadDispatcher = new cc.KeypadDispatcher.getInstance();


KeyboardDispatcher should be singleton in the project.

Could you please provide us any code to reproduce the issue?


Hello, Shun Lin.

In previous version of cocos2d-html5 (Cocos2d-html5-v0.5.0-alpha2) in file CCDirectod.js keypad dispatcher inited by this way:
this.*keypadDispatcher = new cc.KeypadDispatcher;
This is wrong. But now I see the new version of cocos2d and ther in CCDirector.js keypad dispatcher inited by this way:
this.*keyboardDispatcher = cc.KeyboardDispatcher.getInstance();

And this is correct. So, you don’t need any updates in this error, because the new version is all fixed.


Not sure if this helps but if the cocos2d-x team wants to add it then this should help. See this post:


This is for OSX platform so someone would need to add Unix and windows platforms by modifying the corresponding EAGLView class.