Tweeper Posted October 26, 2014 Share Posted October 26, 2014 I'm running a game html document, made in Phaser, from within an iframe.To my surprise when the iframe loses focus (on the same browsertab), Phaser stops updating.I can see the render-event still got fired, but not the update-event. I'm surprised by this. Normaly I use Greensock tick events together with PIXIjs, or easelJS onTick function, and there I never had this problem; both always got fired, independent of the iframe focus. I understand Request Animation Frame isn't raised if the browsertab/window isn't active and that's fine with me. But I want both the rendering and updating to continue if the same tab remains active and the iframe loses it focus too. I just recently switched to Phaser, so please forgive me if this is a silly question, but am I missing something here? Is there some setting in phaser I can set to true to prevent the update-event from being stopped when the iframe, handling the gamedocument with canvas, loses focus? Link to comment Share on other sites More sharing options...
clark Posted October 27, 2014 Share Posted October 27, 2014 Hey mate Does this fix your problem? Put it in your Boot state or something. this.game.stage.disableVisibilityChange = true; Link to comment Share on other sites More sharing options...
Tweeper Posted October 27, 2014 Author Share Posted October 27, 2014 Yes! That was it! Thanks clark!! BTW This also solved another issue I had with button clickareas when the animation, running from within an iframe, was on fullscreen clark 1 Link to comment Share on other sites More sharing options...
Recommended Posts