charlie_says Posted March 23, 2014 Share Posted March 23, 2014 This is essentially a v1 to v2 migration question: I have this code:holder = game.add.group();holder.bg = holder.create(0, 0, 'bg');holder.bg.events.onInputDown.add(this.level_clicked, this);then laterlevel_clicked: function(bg){var holder = bg.group;...this was working in v1, but fails in v2. I guess I could set a variable myself - but is this information now stored elsewhere? Link to comment Share on other sites More sharing options...
rich Posted March 23, 2014 Share Posted March 23, 2014 Have you enabled holder.bg for input?holder.bg.inputEnabled = true;This was on by default in v1, and is off by default in v2. Also be careful with the approach you're using. Basically you are creating a new property ('bg') on the holder Group, so just make sure you don't name your property the same as any of the methods of properties a Group actually really has and needs! Otherwise there is no telling what may happen. Link to comment Share on other sites More sharing options...
charlie_says Posted March 23, 2014 Author Share Posted March 23, 2014 Hi.yes inputEnabled is set to true already...Results inline:level_clicked: function(bg){console.log(bg);// returns b.Sprite {game: b.Game, name: "", type: 0, z: 1, events: b.Events…console.log(bg.group);// returns undefined Link to comment Share on other sites More sharing options...
rich Posted March 23, 2014 Share Posted March 23, 2014 There's no such property as 'group' on Sprite any more. You'd get that from Sprite.parent now. It's well worth having a read through the Migration Guide btw as there may be other things like this we list in there that may catch you out. Link to comment Share on other sites More sharing options...
charlie_says Posted March 24, 2014 Author Share Posted March 24, 2014 Thanks that did it. I did read through the migration guide - clearly not closely enough, will give it another read Link to comment Share on other sites More sharing options...
Recommended Posts