hello all, i am stuck here
i am trying to trigger a function after a certain delay, which is why i used setInterval.
i can get the function to happen after a certain time, but clearInterval doesnt seem to work
it always worked before, when i was not writing it in oop, is there something special with this function when it’s used in oop?
in the Delay.as file:
class Delay extends MovieClip {
//
///////////////
// variables //
///////////////
//
var delay:Number;
private var countdown:Number;
//
/////////////////
// constructor //
/////////////////
//
function Delay () {
}
//
///////////////////////////
// functions definitions //
///////////////////////////
//
function init (x:Number, y:Number) {
this._x = x;
this._y = y;
}
function onRelease () {
traceStuff ();
}
//
function traceStuff () {
this.countdown = setInterval (delayedtraceStuff, 2500);
}
function delayedtraceStuff () {
this.delay--;
if (delay <= 0) {
trace ("stuff");
clearInterval (this.countdown);
}
}
//
}
on test_delay.fla stage:
this.attachMovie ("square_inLib", "square", this.getNextHighestDepth ()).init (64, 64);
quite appreciated if someone could explain what im doing wrong
see attached files if need be.