spencerTL Posted August 22, 2014 Share Posted August 22, 2014 I have a number of simple puzzles and each one runs on a separate html doc. These html docs then are part of a jquery mobile app. As these exist simultaneously so that I can use the page transitions I can't leave them all running so when I change pages I call destroy on the Phaser game. The puzzles I wrote using Phaser 2.0.0 work great doing this. They stop running and no problems. However the ones written with 2.0.7 never stop listening for loss of focus (I think that's what the error suggests?) Changing this.game.stage.disableVisibilityChange to either true or false has no effect. I see that destroy has been called, I have a console.log sending out updates from the update function and these stop after destroy, but when the page changes the console keeps showing this error: Uncaught TypeError: Cannot read property 'disableVisibilityChange' of null This makes sense as the game is destroyed but this error locks up the page. It also does this again if I change tab or change from the browser to another application. Is their something else I must do prior to destroy() or is their a manual way of removing what I presume are listeners that exist independently of the game? Any ideas appreciated thanks. Link to comment Share on other sites More sharing options...
eguneys Posted August 23, 2014 Share Posted August 23, 2014 I've opened an issue on github https://github.com/photonstorm/phaser/issues/1092. Link to comment Share on other sites More sharing options...
spencerTL Posted August 23, 2014 Author Share Posted August 23, 2014 Thanks for letting me know. I spent hours trying to solve this yesterday. I can move on and wait for a fix now. Link to comment Share on other sites More sharing options...
eguneys Posted August 23, 2014 Share Posted August 23, 2014 As for now, I simply refresh the page to destroy the game.window.location.reload(true); Link to comment Share on other sites More sharing options...
spencerTL Posted August 23, 2014 Author Share Posted August 23, 2014 Thanks. Doesn't the game restart on a refresh though? When a page is navigated from, I can refresh but it once it does it'll start running again, and with 10 pages that's 10 games still running concurrently.Or am I missing something? Link to comment Share on other sites More sharing options...
eguneys Posted August 23, 2014 Share Posted August 23, 2014 Oh yeah you need to start the game manually by clicking a button or something Link to comment Share on other sites More sharing options...
Recommended Posts