I’ve got a container with some sprites and after each player move, the sprites in the container are changed.
It seems that for setting the active
property of all sprites I can either use setAll()
or Container.each(setActive..
but in order to set visible
for all sprites I have to use Container.each
?
// this doesn't work
myContainer.setAll('visible', false); // all sprites are still visible
// this does work
myContainer.each(function(sprite) {sprite.setVisible(false) } ); // ok
// this works
myContainer.setAll('active', false); // also ok
// and this also works
myContainer.each(function(sprite) {sprite.setActive(false) } );
So I can get the code to work, but I don’t quite understand why after setAll('visible', false)
all sprites are still visible. I mean, how can I know which properties do or do not work like this, or why doesn’t setAll
always work the same?