I am probably wrong but when you clear fnCount your just clearing the variable not the instance started form it . Thus requiring you to stop the periodical before you clear it .
On Thu, Jan 14, 2010 at 3:20 PM, Gafa <[email protected]> wrote: > Here is a code snipit. When the drag onComplete event is fired, the > variable fnCount becomes cleared but the periodical still runs. It's > not clear to me what I'm doing wrong. Thanks for any help. > > initRecordAnimation: function() { > this.controlCoordinates = new Array(); > var i = 0; > var fnCount; > > $(this.options.activeControl).makeDraggable({ > onStart: function() { > //start time counter > if ($('chkRecord').checked) { > var x = { counter: 0 }; > fnCount = function() { $('divAnimationTime').set > ('html', '<b>Time: ' + this.counter++ + '</b>'); } > fnCount.periodical(1000, x); > } > > }, > onDrag: function(el) { > if ($('chkRecord').checked) { > this.controlCoordinates[i] = el.getPosition(); > i++; > $('divNumberOfFrames').set('html', '<b>frames: ' + > i + '</b>'); > } > > this.updateControlPosition($ > (this.options.activeControl)); > } .bind(this), > onComplete: function() { > this.animationNumberOfFrames = > this.controlCoordinates.length; > fnCount = $clear(fnCount); > > } .bind(this) > }); > }, >
