> After Robert mentioned it, I can think of no good reason for maintaining an
> all[] and allID[] array. I don't think there's enough benefit to justify
> having both. As he suggested, the dyndocument could just as easily keep a
> numeric count as DynLayers are added and removed.
>
> This would also remove potential memory leaks and speed things up a bit.
> Unless someone has other ideas, I would suggest removing the numeric all[]
> and replace it with allID, renaming it to all[], of course.
While it wouldn't be as easy, I think the same can be done for the
.children array. If it were an associative array with the indexes
being ids, it would improve the speed of deleteChild and removeChild
since they would not have to loop through all of the children. The
whole point of those loops is to verify the child exists. Then you
could just say if (this.children[id]). Maybe just add a function
hasChildren() that returns true/false.
As far as naming, .allID should definately be renamed to .all, but of
course that would affect the way you access inline layers, so the
tutorials would need updating.
\\Robert
--
|