關於shchedule的使用

我使用http://api.cocos.com/cn/d3/d82/classcocos2d_1_1_node.html#a3896e9a1095586f629eceee54b6aced0 里面的API

var schedule(var selector,var interval,var repeat,var delay )


以下是我的程式码:

onLoad: function () {     this.schedule(testFunc, 1.0, "kRepeatForever" ,3.0, "CountDown");
        function testFunc()         {               console.log("testFunc");          this.unschedule("CountDown");       }    },

请问,我的用法哪边有错误吗?
怎么unschedule无法停止schedule呢?

_callback: function () {
    this.node.runAction(this.seq);
    if (this.repeat) {
        this.counting = true;
    }
    else {
        this.counting = false;
    }
    this.time = 5;
    this.counter.string = this.time.toFixed(2) + ' s';
},    

stopCounting: function () {
    this.unschedule(this._callback);
    this.counting = false;
    this.counter.string = '5.00 s';
    this.time = 5;
},

repeatSchedule: function () {
    this.stopCounting();
    this.schedule(this._callback, 5);
    this.repeat = true;
    this.counting = true;
},

oneSchedule: function () {
    this.stopCounting();
    this.scheduleOnce(this._callback, 5);
    this.repeat = false;
    this.counting = true;
},

cancelSchedules: function () {
    this.repeat = false;
    this.stopCounting();
}

新建项目时选择范例集合模板,里面的 Scheduler 例子里有演示

请参考 Scheduler 的使用文档

http://cocos.com/docs/creator/scripting/scheduler.html

Cocos 的标准 API 并不完全适用于 Cocos Creator

万分感谢二位的回覆。

请问想要停止自带的update用什么方法?
this.unschedule(this.update);停不下来

update 停止不了,除非删除,如果你的回调并不是每帧都需要,或者并不是在整个生命周期中持续的,请不要用 update。或者也可以用标记来控制,比如 if (!pause) 之类的

删除可以这样做:

this.update = null;

哦哦明白了,那我这个情况适合自己定义一个update,非常感谢!