比如
this.loadNum=0;
//资源加载进度中函数
_proto_.onProgress = function(){
//显示加载进度
Laya.timer.loop(100,this,this.ontime);
this.txt_load.text = "资源加载中,当前进度:" + parseInt(this.loadNum) + "%";
//this.onComplete();
}
//时钟定时执行函数
_proto_.ontime = function(){
this.loadNum=parseInt(this.loadNum) + 1;
console.log(this.loadNum);
return this.loadNum;
}
控制台可以看到 ontime函数每隔 100毫秒就执行一次,this.loadNum的值在不断自增。
但是
this.txt_load.text = "资源加载中,当前进度:" + parseInt(this.loadNum) + "%";
里面的this.loadNum的值确只会输出0,不会自动更新。
这是为啥??