Not a stupid question at all. This stumps a lot of people trying to do OO setTimeout & SetInterval.
Think about when the function is executed.
if you do
then you are in the scope of the object
If you use
Then when the interval fires 'this' no longer references your object.
The way I set up OO timers is to give the object an id, then use the id to create a global variable. You can then create your own timer routine to provide OO timeouts.
You can then call it in your methods like this
var id = "myObj" + idNo++;
this.id = id;
window[this.id] = this;
/*** Rest of object initialization ***/
myobj.prototype.setInterval = function(f, t)
/*** Construct a string like : "window['myObj1'].func()" ***/
setInterval("window['" + this.id + "']." + f, t);
If you want you can do the var/id creation on one line
window[this.id = "myObj" + idNo++] = this;