# Making objects in group non-interactive

**URL:** <https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588>\
**Category:** Phaser 3\
**Created:** [January 3, 2019, 7:26pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588 "2019-01-03T19:26:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![casey](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/casey/32/2503_2.png) [@casey](https://phaser.discourse.group/u/casey)\
**Post date:** [January 3, 2019, 7:26pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588/1 "2019-01-03T19:26:32Z")

</div>

I’m trying to migrate a project from P2 to P3.  
I populate a row and make the objects (obj) in the row and add them to a group.  
But later I want to set the whole row non-interactive, I can’t seem to access them any way without throwing an error.  
in create:  
//row8  
this.positions =[{x: 55, y:440}, {x:110, y:440}, {x:165, y:440}, {x:220, y:440}];  
this.group8 = this.add.group();  
for(var i in this.positions){  
//create the sprite  
this.pos = this.positions[i];  
this.obj = this.add.sprite(this.pos.x, this.pos.y, ‘colours’, 6).setInteractive();  
//on click call the clicked function  
this.obj.on(‘pointerdown’, this.clicked);  
//add the sprite to the group for the row  
this.group8.add(this.obj);  
}  
//enter button  
this.enter8 = this.add.image(280, 440, ‘enter’).setInteractive();  
this.enter8.on(‘pointerdown’, this.onEnter8);  
};

gameScene.onEnter8 = function(){  
_//this is the line that I don’t understand/can’t get to work._  
this.group8.getChildren.setInteractive(false);  
}

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [January 3, 2019, 7:52pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588/2 "2019-01-03T19:52:23Z")

</div>

Two issues with the line you’re having trouble with.

First, `getChildren` is a function, so you need to call it rather than just access it. So for that, you’d say `this.group8.getChildren()` instead of `this.group8.getChildren`.

Second, `getChildren` returns an array, so you’ll need to iterate over all the game objects in it and call `setInteractive(false)` on each of them. Phaser provides a nice way to do this with the [`Phaser.Actions.Call`](https://github.com/photonstorm/phaser/blob/master/src/actions/Call.js) method. So it could look something like this:

```javascript
Phaser.Actions.Call(this.group8.getChildren(), function(child) {
  child.setInteractive(false);
});

```

---

<div class="post-metadata">

**Author:** ![casey](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/casey/32/2503_2.png) [@casey](https://phaser.discourse.group/u/casey)\
**Post date:** [January 3, 2019, 8:07pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588/3 "2019-01-03T20:07:42Z")

</div>

Many thanks!  
Unfortunately, while it doesn’t throw an error, it doesn’t work: the interactivity here is the sprite frame changing on click. I want to stop that ability with this setInteractive(false). Is this not how to turn off that ability?

In other words, I want to make them un-clickable.

sorry for the noob question. Finding P3 more difficult than P2.

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [January 3, 2019, 8:18pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588/4 "2019-01-03T20:18:50Z")

</div>

Ah, no its not. You want to use `disableInteractive()`.

---

<div class="post-metadata">

**Author:** ![casey](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/casey/32/2503_2.png) [@casey](https://phaser.discourse.group/u/casey)\
**Post date:** [January 3, 2019, 8:20pm UTC](https://phaser.discourse.group/t/making-objects-in-group-non-interactive/588/5 "2019-01-03T20:20:41Z")

</div>

Hallelujah! Been stuck on that for hours! 😌
