On Window closed event?

Discussion and feedback on Construct 2

Post » Wed Nov 26, 2014 8:38 pm

Hi, i want to save the time when i close the game, i tried to do it with "On end of layout" and Browser`s "On suspended" but it isnt working. I feel that "On suspended" should be the correct way to do it, is it really?

Please help, i need this to calculate the time away for mi iddle game.
B
13
S
3
Posts: 101
Reputation: 1,238

Post » Wed Nov 26, 2014 10:53 pm

So this is what the manual says:

On suspended
On resumed
Triggered when the page's visibility changes, or when a mobile app is going in to the background or foreground. When invisible or in the background the app is suspended: all events stop running and all audio is muted.


So it wouldn't be triggered when closed. There is no on closed action, because browsers don't support it.

However, what you can do is store the time in webstorage on every second. That way you know the time when the game was closed when opened.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542

Post » Thu Nov 27, 2014 10:01 am

Ok wow i never thought about that, i feel stupid now, i guess i was very frustrated to think clearly lol. Thanks for the help man! =D
B
13
S
3
Posts: 101
Reputation: 1,238

Post » Thu Nov 27, 2014 1:07 pm

No problem. It's not the most efficient solution but without a close event I'm not sure how else it could be done.
ImageImageImageImageImage
B
19
S
5
G
1
Posts: 614
Reputation: 2,542


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 11 guests