I’m wishing to trigger a function to pause my project (game) on the html target, whenever it’s obvious that the game isn’t being played. then unpause if the user returns to it.
In flash it used to be straighforward, listen to Event.DEACTIVATE, Event.ACTIVATE, the use of these events when compiling to the html target give mixed results, and in many browsers dont fire when you expect them too (e.g. minimising the browser / opening addition browser windows etc)
I’ve been directed by a html progrmmer to read up on the “Page Visibility API” , the visibilitychange event fires at obvious times, and document.hidden / document.visibilityState can be queried to discover the state of view of the game.
I’d really like to know how i could use this api, or query the document.visibility state within my code, as i’ve no idea how to reference the document directly from within openfl. any help greatly appreciated.
Whilst it would be great to be able to learn how to contribute to openfl, I’ve no idea how openfl works behind the scenes, I’d need to learn how github works too. I currently scrape by with little programming knowledge and good intentions, I bring things up on the forums i find that dont work, as i simply dont have the knowledge to know how to fix them ! (i’m not using the latest versions as my games dont work well with it either!)