properties: {
time:0,
},
onLoad: function () {
this.schedule(this.updataTime,1);
},
updataTime:function(){//更新时间的回调函数
this.time++;
var com=this.getComponent(cc.Label);
com.string="Time:"+this.time;
}
//开启定时器
this.schedule(this._callback, 5)
this.scheduleOnce(this._callback, 5);
//关闭定时器
this.unscheduleAllCallbacks();