Hi
In my project, there are some dialog, and i wanna to close them one by one when user press back key.
How can i implement it?
show : function() {
this.node.active = true;
...
cc.systemEvent.once(cc.SystemEvent.EventType.KEY_DOWN,
this.onKeyPressed,
this);
...
}
onKeyPressed: function (event) {
if (event.keyCode === cc.KEY.back || event.keyCode === cc.KEY.backspace || event.keyCode === cc.KEY.escape) {
this.hide();
event.stopPropagation();
}
}
hide : function() {
this.node.active = false;
}
But when i press back key, all dialog close.
I want to close some dialog one by one.
How???
Thanks.