var CountdownBar = (function () {
function countdownBar() {
PauseDialog.super(this);
this.name = 'CountdownBar';
Laya.stage.addChild(this);
this.zOrder = 100;
this.count = 4;
this.countLabel.text = '' + this.count;
Laya.timer.loop(1000, this, this.countdown);
}
Laya.class(countdownBar, "CountdownBar", CountdownUI);
return countdownBar;
}());
CountdownBar.prototype.countdown = function () {
this.count--;
if (this.count > 0) {
this.countLabel.text = '' + this.count;
}
else {
Laya.timer.clear(this,this.countdown);
this.destroy(true);
}
}
这是一个继承自laya.ui.Dialog的对象,设置this.zOrder = 100;导致numChildren异常,关闭时报错。
开发者往往并不能确定确切的zOrder值,可能预设一个较大的值,如果这值不合规范,应该在接受这个值以后自动调整;
个人认为这是框架应该做的事情,至少AS3是有这样的功能的