用 update 函数来实现长按计时。


                    //长按处理
                    update: function (delta) {
                     cc.log("update  + "+delta);
                        this.totalTime+=delta;
                        if(this.totalTime>=TOUCH_LONG_TIMER_INVOKE){
                            this.stopTimer();
                            this.invokeTouchLong();
                        }
                    },
                    stopTimer: function () {
                        this.unscheduleUpdate ();
                        this.totalTime=0;
                    },
                    startTimer: function () {
                        this.isTouchLong=false;
                
                        this.scheduleUpdate ();
                
                    }
                    ,
                    invokeTouchLong: function () {
                
                        cc.log("长按")
                        this.isTouchLong=true;
                
                
                    },
                
                
                
                    ctor: function (id) {
                
                        this._super();
                
                btn.addTouchEventListener (function (a1,type) {
                
                            if(type ==0){//按下
                
                                self.startTimer ();
                
                
                            }
                            if(type==1){ /////移动
                                move=true; self.stopTimer ();
                            }
                            if(type==2){ // 结束
                                self.stopTimer ();
                
                                if(!move  && ! self.isTouchLong){
                                    cc.log("click ");
                                }
                                move=false;
                            }
                
                        })