Preventing touch in underneath layers?

Hello everyone, just wondering if anyone could help with this problem, it's probably going to be really obvious but I can't figure it out...

I have a layer that pops up on top of the screen with options and stuff on, and I need to prevent the lower layer from being touched while the top layer is on screen. I have made a boolean attribute called allowtouch which is turned off when pushing the button to load the top layer.

When you close the top layer, the button changes the allowtouch attribute back on and this all works fine, nothing can be touched while the top layer is active.

The only problem is that when touching the button to close the top layer, anything under the button itself on the lower layer responds to the touch of the button. Is there a way round this without using timers or anything like that?

Thanks!

Comments

  • SingleSparqSingleSparq Member Posts: 1,339
    Create an attribute Boolean called popupactive or something. Put a rule on any button below the one you want to use to not work if that is active. Disable it when you use the popup you want to use when pressed.
  • shortwaveshortwave Member Posts: 29
    I think this is what I have done already, just that the actual button that disables the popupactive itself is on top of buttons underneath, so when it allows touch again it pushes the underneath button...
  • SingleSparqSingleSparq Member Posts: 1,339
    Sorry I should have read your description completely. I have the same set up and it's not an issue but I think the difference in mine is that my buttons do their purpose and then I have another back button that isn't over any button below so it won't trigger them. You can also move the lower bottoms off screen when option buttons are 'active' or try using button release instead of button pressed for your actions and maybe that will offset the timing.
  • SocksSocks London, UK.Member Posts: 12,822
  • vijayrajeshvijayrajesh Member Posts: 8

    @Socks Thanks this worked for me too. But I do not understand the logic how it works. Can you please explain? How the "mouseposition inside helpful here. Also, will it work on touch devices too?

  • SocksSocks London, UK.Member Posts: 12,822
    edited February 2015

    @vijayrajesh said:
    Socks Thanks this worked for me too. But I do not understand the logic how it works. Can you please explain?

    Not much to explain really:

    If you press the red actor the size changes + an attribute is switched on when the mouse is inside the area of the red actor.

    If you press the blue actor the size changes - unless the above attribute is switched on.

    @vijayrajesh said:
    How the "mouseposition inside helpful here.

    It checks to see if the mouse is inside the area of the actor.

    @vijayrajesh said:
    Also, will it work on touch devices too?

    Yes.

Sign In or Register to comment.