this._onlineScheduleHandle = this.updateOnlineTime.bind(this); cc.director.getScheduler().unschedule(this._onlineScheduleHandle,this); cc.director.getScheduler().schedule(this._onlineScheduleHandle,this,1.1,cc.REPEAT_FOREVER,false,"keyCountDownTime");
Cocos2d-js中,回调函数一定要先保存起来,例如 this._onlineScheduleHandle = this.updateOnlineTime.bind(this);
其次 cc.director.getScheduler().schedule(this._onlineScheduleHandle,"keyCountDownTime");这个参数一定要写全,否则出问题。
原文链接:https://www.f2er.com/cocos2dx/338817.html