How do I quit the game through a event?(solved)

Get help using Construct 2

Post » Fri Feb 12, 2016 9:01 am

I would like to know if there is a way that by using the event of clicking a button i could close my game (like doing
alt-f4 closing a page)?
Last edited by currypuff on Fri Feb 12, 2016 10:32 am, edited 1 time in total.
B
14
S
3
Posts: 55
Reputation: 912

Post » Fri Feb 12, 2016 10:12 am

Use the browser object.

One of its action is "Close". If the script is permitted, it will close the tab/windows currently executing.
As mentioned it may not work 100% everywhere, as it depends on some user's given permission.

But that's the closest answer to the question you did ask.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,319
Reputation: 87,487

Post » Fri Feb 12, 2016 10:32 am

Thank you, that was exactly what i was looking for.
B
14
S
3
Posts: 55
Reputation: 912

Post » Sun Feb 14, 2016 1:04 pm

Using Browser.close doesn't always work, as Kyatric stated.

Another way that works in other cases to close the browser is to fake opening a new window and closing it, This can be done by using the following command with
the Browser plugin:

Browser.ExecuteJavaScript "window.open('','_parent','');window.close();"
B
10
S
3
Posts: 87
Reputation: 957


Return to How do I....?

Who is online

Users browsing this forum: ezgaming420, marcinkowski, plinkie and 11 guests