Joost Diepenmaat <jo***@zeekat.nlwrote:
IOW, you need to "clear out" any references to objects you
want to clean up, either by explicitely assigning them some other
value (as you do here), or by letting the references go out out scope.
in fact, after your answer, i've tried tu nullify the reference to the
object instance, without any effect, by doing simply :
a_child=null;// from parent
my object is a tree, where i create branches, when a branch (another
instance of a tree) is finished to display (the objects are drawing
lines over a canvas), i want to destroy it.
the script reads a rule (a string) like that :
"F+[-F...]+F..."
when a parent reads a "[" symbol it creates a child which reads the
(sub)rule to it's closing "]", it is there i want to destroy the child.
for the time being the only way i've found to stop the child is to
advance it's index to the end of the rule.
line 126 :
case ']':
this.parent.restore(this);// returns action to the parent
this.index=this.rule.length-1;// go to the end of rule
break;
line 71 :
this.restore=function(child){
this.penUp();
ctx.moveTo(this.x,this.y);
this.penDown();
this.index=child.index+1;// continue action where the child left it
this.actRule(this.rule);
return this;
};
my testing code is at the page
<http://thoraval.yvon.free.fr/Canvas/l_system.xhtml>
--
Une Bévue