setKeypadEnabled(true) on CCScene

setKeypadEnabled(true) on CCScene
0.0 0


I have added CCMenu as child in my CCscenes (i.e. there is not CClayer) and i want to setKeypadEnabled(true) to bring my director back to previous scene as use presses back key on android. i can only set setKeypadEnabled(true) on CCLayers by overriding keyBackClicked() but how can i do it when i don’t have any CCLayer?


Inheriting from CCKeypadDelegate and register into CCKeypadDispatcher like CCLayer::setKeypadEnabled(bool) do.
Don’t forget to removeDelegate in CCYourScene::onExit(), otherwise your scene will never be deleted from memory.


Thank you so much Walzer Wang, you are great :). Not only i have made it work but i got to understand a lot of things while solving my issue :slight_smile: