using the setTimeout function for multiple instances of an object
Posted on 2003-03-22
i have several instances of an object, and a method that calls itself repeatedly with setTimeout. if just one instance uses it then there is no problem. once a second ones comes it "overrides" the previous one and now the second instance has 2 occurences of the method.
I made the following example to illustrate my problem - instead of seeing on the screen 'a b a b a b' it comes out as 'a b b b b b b'. u can see the "b"'s coming out in pairs.
<div id="outputArea" style='position:absolute;top:100';left:100'></div>
var a=new aObj();
var b=new aObj();