I am posting an answer to a question I could not find.
var imgs=[];
doge=new imgage_wrapper("50","10","10","doge1.png");
imgs.push(doge);
for(var i=0;i<imgs.length;i++)
{
var test = imgs[i];
setTimeout(function(){test.destructor()},1000);
}
This works. However,
for(var i=0;i<imgs.length;i++)
{
setTimeout(function(){imgs[i].destructor()},1000);
}
Does not work. That is the answer.
Now, I am not sure I know WHY this is the answer. Can you illuminate me?