How do I temporarily block "Mouse" events?

Get help using Construct 2

Post » Thu Aug 31, 2017 12:54 pm

I have a game with many elements. I want to allow people to pay for some features. My game runs in an iFrame on a page and sometimes I want to show the "deposit money" pop up on top of the iframe. However there is a problem: when the pop up is on - all mouse signals go through, because "Mouse" subscribes "mousedown" on a document level, so even if I put the overlay div with higher z-index than c2canvas inside the iframe - it won't block mouse events.

The question is: is it possible to block mouse events without adding the blocker div outside of iframe?
B
6
S
2
Posts: 30
Reputation: 540

Post » Thu Aug 31, 2017 7:09 pm

I'm not sure if I understood your question, but if you want to disable mouse events, put them inside a group and toggle that group disabled whenever you need it.
B
20
S
6
Posts: 143
Reputation: 1,666

Post » Mon Sep 04, 2017 8:55 am

Given that I don't do it from the C2 - it all must be done by the wrapper.
B
6
S
2
Posts: 30
Reputation: 540

Post » Mon Sep 04, 2017 9:42 am

Have you tried Browser events "On Suspended" or "Page is visible" (in C2)?
If any of them is triggered when your payment window pops up - you can disable mouse events there.
Check out my awesome game Doptrix
B
17
S
8
G
9
Posts: 195
Reputation: 6,379

Post » Mon Sep 04, 2017 12:54 pm

I tried "window.cr_setSuspended(true)" function, but it blocks the view only - all clicks go through.
What is "Page is visible", how do I call it?
B
6
S
2
Posts: 30
Reputation: 540

Post » Mon Sep 04, 2017 1:29 pm

It's in Construct 2.
Add Browser object one of the layouts. Create an event:
Code: Select all
Browser ->
    Page Is Visible -> do nothing
    Else -> do something (like play a sound)


See if the Else block is triggered when your pop up window opens. If it does, then you can block mouse input there.

You can try the same with Browser->On Suspended.


EDIT: Sorry, I didn't notice that you need to do this in the wrapper. So you can't change the C2 code at all?
Check out my awesome game Doptrix
B
17
S
8
G
9
Posts: 195
Reputation: 6,379

Post » Mon Sep 04, 2017 3:26 pm

No, I can't there is a list of games that I have to load in my wrapper and they can not be altered only because of this thing I do. Alright, I'll have to put some div on top of the iFrame with game, this will definitely work. Thank u for help!
B
6
S
2
Posts: 30
Reputation: 540


Return to How do I....?

Who is online

Users browsing this forum: atmas, lukewasthefish and 12 guests