how to handle return key or menu key in jsb.

how to handle return key or menu key in jsb.
0.0 0


I am looking for a way to handle keypad on jsb.
Keydispatcher has a const value like : cc.TYPE_BACK_CLICKED = 1;

I had onKeyDown function in my own layer code, but it doesn’t work as the same as keyBackClicked(it is a vitrual function of CCLayer in C++).

Will some one tell me what can I do to handle the menu key and return key on android in jsb.


After reading [] ,
I try to rename the call back function to backClicked(why is it different from the definition of “virtual CCLayer::keyBackClicked”),
and it works with “this.setKeypadEnabled(true);” in layer.onEnter.

Three problems here:
# backClicked is not a function of cc.Layer, so this._super() cann’t be used here.
# obfuscating the code will obfuscate “this.setKeypadEnabled(true);” to “this.Si(1)” lead to the error “this.Si is undefined”.
# backClicked will be obfuscated too.

By the way, cc.RemoveSelf is not exported for jsb yet(it works for html5).