jflowers45 Posted February 26, 2014 Share Posted February 26, 2014 Based on the documentation I assumed that if I destroy a group, all children will be destroyed. This doesn't seem to be the case with buttons. I've created as simple an example as possible at the url below. Click 'show scoreboard' - this creates a group, creates a button, adds button to group. Then, try the two 'hide scoreboard' buttons. They each have different callbacks - one of the callbacks just destroys the group. The other one destroys the button first, then destroys the group. After you call the one that only destroys the group, you can see the error below related to the mouse pointer. http://www.flashysubstance.com/phaserGroupDestroy/ Anyone have any ideas? Uncaught TypeError: Cannot read property 'visible' of null phaser.js:12505 Object.defineProperty.getphaser.js:12505 Phaser.InputHandler.checkPointerOverphaser.js:17151 Phaser.Pointer.movephaser.js:16015 Phaser.Mouse.onMouseMovephaser.js:15348 _onMouseMove Link to comment Share on other sites More sharing options...
rich Posted February 27, 2014 Share Posted February 27, 2014 Group.destroy has a boolean parameter: destroyChildren which is false by default, but in this case needs to be true. If that's not available in the version of Phaser you're using then I'm sorry, it's hard for me to keep track when things were added! Also in 1.2 I did quite a lot of work on this today, see this commit: https://github.com/photonstorm/phaser/commit/7e12075be142e91193a0bd00d7cc0f33869d7e93 Link to comment Share on other sites More sharing options...
jflowers45 Posted February 27, 2014 Author Share Posted February 27, 2014 Thanks Rich! I'm on 1.6 and once I added the true parameter that fixed the problem I was having. I may have just not noticed the destroyChildren parameter or I may have looked at old documentation. Very cool to see your commit from today as well! Link to comment Share on other sites More sharing options...
Recommended Posts