Actually I have 4 ActorContainers to show one or two Actors inside each one.
To do this, I use two buttons: PREVIOUS and NEXT.
If I press NEXT button, all Actors must be removed from each ActorContainer
and then display new ones. I do this by simply calling emptyChildren()
and addChild(newActor).
// To empty all ActorContainers
for(var i=0; i < 4; i++) {
actorContainer[i].emptyChildren();
}
// To load new actors
for(var i=0; i < 4; i++) {
actorContainer[i].addChild(newActor);
}
This works fine for short time. Then I get an error saying:
Uncaught adding to a container an element with parent
Somehow emptyChildren() is not working out as I expected.
Hi,
Actually I have 4 ActorContainers to show one or two Actors inside each one. To do this, I use two buttons: PREVIOUS and NEXT.
If I press NEXT button, all Actors must be removed from each ActorContainer and then display new ones. I do this by simply calling emptyChildren() and addChild(newActor).
// To empty all ActorContainers for(var i=0; i < 4; i++) { actorContainer[i].emptyChildren(); }
// To load new actors for(var i=0; i < 4; i++) { actorContainer[i].addChild(newActor); }
This works fine for short time. Then I get an error saying:
Uncaught adding to a container an element with parent
Somehow emptyChildren() is not working out as I expected.
Any ideas?
Thanks.