Hello fellow kirupians. Time for me again to ask for you help.
I’ll begin with the example code
class className () {
//constructor
function className(targetmc,linkId) {
xxx = targetmc.attachMovie(linkId,targetmc.getNextHighestDepth());
xxx.onPress = function () {
// this here refers to the newly created mc.
this.startDrag();
intvl = setInterval(updater,200); // this doesnt work
// nor does the flowing because this reffers to the mc I press not to the instace of the class
intvl = setInterval(this.updater,200);
}
}
private function updater() {
trace("Updating + "+getTimer())
}
}
My question is how can I set up an interval when I click on a button that is created from within the class.
I need my function updater to keep repeating untill I clear the interval. The only way I can figure out is to give the full path like
this._parent._parent.instanceName.updater inside the setInterval, but although this works I think is just dumb to hardcode the instace name of the class. I could of course try to pass the instance name as a parameter, but I would really love to find out the smart way to do this (by the book).
Thank you for taking your time and reading this.