Preventing touch in underneath layers?
shortwave
Member Posts: 29
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!
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
Try something like this:
http://www.mediafire.com/?y6ph5uu3hqn6ad9
@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?
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.
It checks to see if the mouse is inside the area of the actor.
Yes.