Any guesses why this shouldn’t work?:
local function onKeyReleased(keyCode, event)
if keyCode == cc.KeyCodeKey.KEY_ESCAPE and self.backButtonListener then
self.backButtonListener()
end
end
local keyListener = cc.EventListenerKeyboard:create()
keyListener:registerScriptTapHandler(onKeyReleased, cc.Handler.EVENT_KEYBOARD_RELEASED)
It doesn’t detect the ESC key when running under the simulator either.