dimanche 29 novembre 2015

removeChild() on parent will remove his child?

I have construction that below:

parent
   + child
   + child
   + child
   + sub-parent
         + sub-child
         + sub-child

For now, I use multiply of "removeChild()", to remove elements from scene one by one. Like that:

removeChild(sub-child);
removeChild(sub-child);
removeChild(sub-parent);
//and so on 

It's okay, but i found out that if I remove parent all his children will disappear from scene too. (but for now i do not know for sure ...)

So my question is quite simple:

How to remove elements from scene in correct way ? As I do now (one by one) or I could remove just a parent and my code will be a little bit shorter. Or it's same thing ?

Thanks in advance!

Aucun commentaire:

Enregistrer un commentaire