Symbol 2 MovieClip [rdTimerClassSymbol] Frame 1
#initclip 1
rdTimerClass = function () {
ASBroadcaster.initialize(this);
this.init();
};
Object.registerClass("rdTimerClassSymbol", rdTimerClass);
rdTimerClass.prototype.init = function () {
this._visible = false;
this.running = false;
this.paused = false;
this.loop = 1;
this.base = (this.timer = getTimer());
this.setCallBack(this.callBack);
if (this.stoptime) {
this._parent.stop();
}
if (this.initrunning) {
this.start();
}
};
rdTimerClass.prototype.onEnterFrame = function () {
if (this.running) {
this.timer = getTimer() - this.base;
this.sendElapsedLoopTimeEvent();
if (this.timer >= this.interval) {
this.sendCompleteLoopEvent();
this.executeCallBack();
if (this.loops > 0) {
if (this.loop == this.loops) {
this.stop();
this.sendLastLoopEvent();
} else {
this.loop++;
this.base = getTimer();
}
} else {
this.base = getTimer();
}
}
}
};
rdTimerClass.prototype.start = function () {
this.base = getTimer();
this.running = true;
};
rdTimerClass.prototype.stop = function () {
this.running = false;
};
rdTimerClass.prototype.reset = function () {
if (this.paused) {
this.paused = false;
}
if (this.loops > 0) {
this.loop = 1;
}
this.base = getTimer();
};
rdTimerClass.prototype.pause = function () {
this.running = false;
this.paused = true;
};
rdTimerClass.prototype.resume = function () {
if (this.paused) {
this.base = getTimer() - this.timer;
this.paused = false;
this.running = true;
}
};
rdTimerClass.prototype.setDelay = function (msecs) {
this.interval = msecs;
};
rdTimerClass.prototype.isRunning = function () {
return(this.running);
};
rdTimerClass.prototype.isPaused = function () {
return(this.paused);
};
rdTimerClass.prototype.currentLoop = function () {
return(this.loop);
};
rdTimerClass.prototype.getDelay = function (msecs) {
return(this.interval);
};
rdTimerClass.prototype.maxLoops = function () {
return(this.loops);
};
rdTimerClass.prototype.setCallBack = function (chng, obj) {
this.handlerObj = ((arguments.length < 2) ? (this._parent) : (obj));
this.callBack = chng;
};
rdTimerClass.prototype.executeCallBack = function () {
this.handlerObj[this.callBack](this._name);
};
rdTimerClass.prototype.sendElapsedLoopTimeEvent = function () {
this.broadcastMessage("onElapsedLoopTime", this._name, this.timer);
};
rdTimerClass.prototype.sendCompleteLoopEvent = function () {
this.broadcastMessage("onCompleteLoop", this._name, this.loop);
};
rdTimerClass.prototype.sendLastLoopEvent = function () {
this.broadcastMessage("onLastLoop", this._name, this.loop);
};
#endinitclip
Instance of Symbol 2 MovieClip [rdTimerClassSymbol] in Symbol 63 MovieClip Frame 30
//component parameters
onClipEvent (initialize) {
interval = 2000;
loops = 1;
initrunning = true;
stoptime = true;
callBack = "Play";
}