RamPackWobble Ah, this works when the player changes tabs, etc., but there is one problem left unresolved - suppose you run the game (either preview or exported to HTML5 and upload to Dropbox) and you right click on the black area that is outside the game's window, "on suspended" won't be fired in this case. Also, the right click contextual menu will pop up and the game will not be "focused", meaning all the keyboard events will not be fired.
What you suggested works to a certain extent but it does not solve the whole problem fully. Nevertheless, thank you for your answer.