IDE Layabox1.7.20.2 beta 版
src/Game.js[code]//var WebGL = laya.webgl.WebGL;
//Laya.init(480, 852, WebGL);
var Game = (function(){
(function Game(){
Laya.init(480,852);
this.bg = BackGround();
Laya.stage.addChild(this.bg);
})();
})();
[/code]src/BackGround.js
var BackGround = (function(_super){
function BackGround(){
BackGround.super(this);
this.bg1 = new Laya.Sprite();
this.bg1.loadImage("war/background.png");
this.addChild(this.bg1);
}
Laya.class(BackGround,"BackGround",_super);
return BackGround;
})(Laya.Sprite);
报错
"TypeError: this.addChild is not a function at BackGround (file:///D:/test/laya/myLaya/src/BackGround.js:6:14) at Game (file:///D:/test/laya/myLaya/src/Game.js:6:19) at file:///D:/test/laya/myLaya/src/Game.js:8:7 at
file:///D:/test/laya/myLaya/src/Game.js:9:3"