# Container, setAll active does work but setAll visible doesn't?

**URL:** <https://phaser.discourse.group/t/container-setall-active-does-work-but-setall-visible-doesnt/8940>\
**Category:** Phaser 3\
**Created:** [February 20, 2021, 10:23pm UTC](https://phaser.discourse.group/t/container-setall-active-does-work-but-setall-visible-doesnt/8940 "2021-02-20T22:23:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BdR](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/bdr/32/2621_2.png) [@BdR](https://phaser.discourse.group/u/BdR)\
**Post date:** [February 20, 2021, 10:23pm UTC](https://phaser.discourse.group/t/container-setall-active-does-work-but-setall-visible-doesnt/8940/1 "2021-02-20T22:23:24Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Milton](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@Milton](https://phaser.discourse.group/u/Milton)\
**Post date:** [February 21, 2021, 4:06am UTC](https://phaser.discourse.group/t/container-setall-active-does-work-but-setall-visible-doesnt/8940/2 "2021-02-21T04:06:02Z")

</div>

setAll checks if the Object has the property.  
A Sprite (GameObject) does have ‘active’ but not ‘visible’ as property after initialization (I guess).  
So only use setAll when you know the Object has the property.

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [February 21, 2021, 4:15am UTC](https://phaser.discourse.group/t/container-setall-active-does-work-but-setall-visible-doesnt/8940/3 "2021-02-21T04:15:07Z")

</div>

This is a quirk of [SetAll()](https://photonstorm.github.io/phaser3-docs/Phaser.Utils.Array.html#.SetAll). It uses a `hasOwnProperty()` test, and `visible` is not an own property.

In this context, it seems like a bug.
