How do I temporarily block "Mouse" events?

0 favourites
  • 7 posts
From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • 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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Given that I don't do it from the C2 - it all must be done by the wrapper.

  • 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.

  • 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?

  • It's in Construct 2.

    Add Browser object one of the layouts. Create an event:

    Browser -> 
        Page Is Visible -> do nothing
        Else -> do something (like play a sound)[/code:3hu5rgzs]
    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?
  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)