- Creator 版本:2.0.7
我在每个场景中都添加一下代码:
`onLoad () {
cc.systemEvent.on(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
},
onDestroy () {
cc.systemEvent.off(cc.SystemEvent.EventType.KEY_UP, this.onKeyUp, this);
},
onKeyUp(event){
var self = this;
if (event.keyCode == cc.KEY.back) {
self.onBtnBack()
}//手机返回键
},
onBtnBack:function () {
cc.director.loadScene(’********’);
},`
结果在用例hello world里面好使,自己项目不行
安卓部分报错如下:
04-17 16
55.765 1793-1892/? E/jswrapper: ERROR: Uncaught TypeError: Cannot read property ‘back’ of undefined, location: src/project.js:0:0
哪位哥哥能看一下问题出来那