Detect mouse down event but only within stage area

I was using
on the stage sprite to detect mouse clicks but then realised that it doesn't work if the mouse is on top of another sprite

So I tried this


but that detects mouse clicks EVERYWHERE!

Is there a simple way of detecting mouse clicks when mouse is over the stage area only ? (Apart from checking x and y co-ordinates)

well, here's a way to do it with any size stage


Wait, that if statement is not needed because it still worked without it; clicking a sprite doesn't trigger it.
I don't know how to fix it for variable watchers without doing some "JS Hacking".

This is from @bh based on an earlier post from me:

Create a boolean var: onstage
Put the following onto the Stage code:

Then in your regular code, check for onstage (TRUE) to eliminate outside of Stage issues.

Hope it helps.

1 Like

just put if block in gen when solution

instead of using
SnapV script pic (12)
SnapV script pic (13)

as told in the true/false help screen