Hi all, I am having a problem in Animate where mouseover layers are being triggered even if there is something over the top. In the below picture the green overlay should not be triggered unless I mouseover the green button below it, and it shouldn't be triggered when the mouse is over the grey popup at all. It seems that even thought the grey popup is above the green one it still triggers the mouseover when the mouse goes into the area where it would be below it (hope that makes sense!). Is there a way to fix this? Each item is on it's own layer in the timeline.
The only way to block a button is with another button.
So I would need to turn the grey box into a button? That seems pretty weird that it can "see through" layers
There is no such thing as "seeing through" a layer. Layers are just an abstract organizational concept. There is no such thing as a "mouseover layer" in Animate. I don't know where you got that expression from. There are buttons, and sometimes movieclips that have been made to act like buttons. Mouse events do not care about layers. Mouse events do not care about anything except symbols that are listening for mouse events. The only thing the mouse event dispatcher looks for is the boundaries of all the current buttons, and which one is highest if any of them overlap. Whichever button the mouse is within, gets the mouse events.
I guess it was expecting it to behave more like HTML with layers above others taking precedence over mouse events. Now I know that buttons block layers behind then I can convert some of the items I need into buttons.
Some strange concepts for me right now (coming from HTML), but thanks for your help it got me headed in the right direction I think.
"Now I know that buttons block layers behind then..."
Buttons. Don't. Block. Layers. Buttons block other buttons. "Blocking a layer" is a nonsense statement.
Sorry but how is that a "nonsense statement", the very fact that they are called layers implies that there is some heirarchy, so I would expect that something "above" something else would stop/"block" anything below it, seeing as I have attached the eventListener to the object in a layer below. The logical thing for me would be to not trigger events on anything that isn't visible, whether that because it's hidden or because there is something else over the top of it. Anyway, I understand now that it doesn't work in the way I expected, as many other things in Animate!
It's a nonsense statement because you can't point at anything on the stage and say "that's a layer". Layers are (primarily) just a mechanism for assigning Z-depth.
If you had button #1 in a higher layer and button #2 in a lower layer, button #1 would only block button #2 if it was physically covering it up. It wasn't, button #2 would not be blocked. Thus, button #1 is not "blocking the layer".
Thank you a lot for this hint!
I've spent 2 hours, trying to solve this "issue" with buttons and with your hint I've solved it finally!