Jump to content

Destroy() game not removing all listeners (I think!)


spencerTL
 Share

Recommended Posts

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

 Share

  • Recently Browsing   0 members

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