Hello! I’m having problems with systemEvent and the cc.KEY.back, this is the code:
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_DOWN, function(){
switch(event.keyCode) {
case cc.KEY.back:
if(self.node.parent.getChildByName("popupExit").active == true){
cc.director.resume();
self.node.parent.getChildByName("popupExit").runAction(cc.sequence(cc.scaleTo(0.12, 0.5), cc.callFunc(function(){
self.node.parent.getChildByName("popupExit").active = false;
self.layout.active = false;
},self)));
self.node.parent.getChildByName("popupExit").runAction(cc.fadeOut(0.12));
self.layout.runAction(cc.fadeOut(0.12));
}else{
self.node.parent.getChildByName("popupExit").active = true;
self.node.parent.getChildByName("popupExit").opacity = 255*0.2;
self.node.parent.getChildByName("popupExit").runAction(cc.sequence(cc.scaleTo(0.10, 0.96), cc.scaleTo(0.02, 1), cc.callFunc(function(){
cc.director.pause();
},self)));
self.node.parent.getChildByName("popupExit").runAction(cc.fadeIn(0.12));
self.layout.active = true;
self.layout.runAction(cc.fadeTo(0.12, 130));
}
break;
default:
break;
}
}, this);
So, when I use cc.KEY.escape instead cc.KEY.back, it works in web version but using “back” doesn’t do anything on mobile version. Am I doing something wrong?
Many thanks!