gskinner/EaselJS — Issue #110: Container's children property issue
Author: vasilpavlov
Created: 2012-02-14 10:04:15+00:00
State: open

Hi,
my issue is I've tried to create my own "class" based on Container. It all worked great until I added two instances of my class on the stage. Then whenever I add a child in one of the instances this object is added in all the other as well. The problem is that the children property is added to the prototype of the Container, and when I do
var p = ContentContainer.prototype = new Container();,
then all instances of my class share the same children array. And it looks kinky :).
My solution is simply to add in the constructor of my class one line that saves the day for me. I've just added this:
this.children = [];
and from then on it all works great. So my question is do I miss something and this is by design, and if my workaround is ok. If it is ok, I think that there should be something in the documentation or to add some example for that. If my solution is somewhat wrong please advise me, because I'm pretty new to the javascript language.

Thanks in advance.