Hi guys,
Does anyone have any idea why I can’t stop the interval
inside the class I created?
class drawClass extends MovieClip {
private var sPointx:Number;
private var sPointy:Number;
private var ePointx:Number;
private var ePointy:Number;
private var pieceNo:Number = 1;
private var currentPart:String;
private var nameIt:String;
private var nTimes:Number;
private var line:MovieClip;
static var emptyClip:Number = 0;
private function init() {
sPointx = this._x;
sPointy = this._y;
}
private function startDrawing(stopIt:Number) {
nTimes= setInterval(this, "drawing", 1);
}
private function stopDrawing() {
clearInterval(this.nTimes);
}
private function drawing() {
ePointx = this._x;
ePointy = this._y;
if (pieceNo == 1) {
emptyClip++;
currentPart = emptyClip+"part"+emptyClip;
line=_root.createEmptyMovieClip(currentPart,_root.getNextHighestDepth());
line.lineStyle(0, 0x0066cc, 100);
line.moveTo(sPointx, sPointy);
}
line.lineTo(ePointx, ePointy);
sPointx = ePointx;
sPointy = ePointy;
pieceNo++;
}
}
I really don’t understand why the interval is not cleared when I
call the function which stops the interval
[“movieclip”].stopDrawing();
:thumb: Thanks guys for checking my thread!
Manolis