hi, I’m trying to call a function depending on where the mouse is clicked on screen - if its clicked within a certain area I want to determine where… I only have a basic knowledge and have put together something like this as part of the code
if (dy < 700 && dy > 100) {
mouseListener.onMouseDown = function() {
if (dx > 400) {nextImage()}
else {prevImage()}
}
}
where dx is the mouse x position and dy the y position (which I’m detecting with onMouseMove), the idea being I’m looking at a portion of the screen vertically and if its less than 400 pixels from the left it will do one thing, if its over another…
this works for the first mouse down in that it wont do anything outside the 100 and 700 pixel limits, but once one click has been registered, any subsequent clicks register even if they are outside my limits… its as if the onMouseDown function is now ignoring my limits
hope that makes some kind of sense?! Can anyone help?