Jump to content
This forum will be closing down. Please move to the respective dedicated project forums.

Getting a parent.


charlie_says
 Share

Recommended Posts

I'm trying to access the parent (in this case a group) of the clicked entity (in this case a sprite). Is that possible?

	create: function ()	{		holder1 = game.add.group();		holder1.id = 1;		holder1.x = 50;		holder1.y = 44;				holder1.bg = holder1.create(0, 0, 'bg');		holder1.circ = holder1.create(150, 4, 'circ');		holder1.line = holder1.create(-15, 0, 'line');		holder1.bg.inputEnabled = true;		holder1.bg.events.onInputDown.add(this.box_clicked, this);   	},	update: function()	{	    		//	},	box_clicked: function(box, pointer) {		console.log(this.parent.id);// not working	},

Is a better way to pass the group in the onInputDown.add?

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...