[]js飞机大战报错 请大神看看

飞机大战第九节报错
我是按照视频打的 但是不知道为什么 貌似每个控件(按钮 label)都是"空的" 一访问就报出异常
 
我查了layaUI.max.all.js文件 里面的组件名正确
 layaUI.max.all.js:
         this.pauseBtn=null;
         this.hpLabel=null;
         this.levelLabel=null;
         this.scoreLabel=null;
         this.infoLabel=null;


GameInfo.js:
var GameInfo = (function (_super) {
    function GameInfo() {
        GameInfo.super(this);
        // this.infoLabel.text = "abc"; 这个也报异常应该是找不到infoLabel
        // 注册按钮点击事件 点击后暂停游戏
        this.pauseBtn.on(Laya.Event.CLICK, this, this.onPauseBtnClick);
        // 初始化UI 显示
        this.reset();
    }
...
 
 

"Cannot read property 'on' of undefined"
"TypeError: Cannot read property 'on' of undefined
    at new GameInfo (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/src/GameInfo.js:12:22)
    at onLoaded (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/src/Game.js:44:25)
    at EventHandler.__proto.runWith (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:688:60)
    at ResInfo.__proto.event (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:467:29)
    at LoaderManager.__proto._endLoad (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:12533:12)
    at Loader.onLoaded (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:12510:11)
    at EventHandler.__proto.runWith (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:688:60)
    at Loader.__proto.event (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:467:29)
    at Loader.__proto.endLoad (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:12173:9)
    at Function.Loader.checkNext (file:///C:/Users/Kevin/Desktop/test/AirWar/AirWar09/bin/libs/laya.core.js:12202:41)"
已邀请:

klm123698745

赞同来自:

已找到错误 继承类写错了 应该写成})(ui.GameInfoUI);

Laya_XS

赞同来自:

好的,有问题再提交。

要回复问题请先

商务合作
商务合作