You do need to track the last location... here is a stack that does what you want. (script could be better i'm sure, but its a starting point.. ) https://www.dropbox.com/s/y6du5nmz5diiv0f/movedir.livecode?dl=0
Basically I put 4 square graphics on screen, top, bottom, right, and left position. Then used the following script.. local smX,smY on mousemove x,y --####If the mouse hasn't moved yet, do the initial fill of the 2 script local variables smX and smY if smx is empty then put x into smx if smy is empty then put y into smy -- Compare the last x position to the current x position and color grc accordingly if smx > x then set the backcolor of grc "ltG" to blue set the backcolor of grc "rtg" to empty else if smx < x then set the backcolor of grc "ltG" to empty set the backcolor of grc "rtg" to blue end if -- same thing for y if smy > y then set the backcolor of grc "upG" to blue set the backcolor of grc "dng" to empty else if smy < y then set the backcolor of grc "upG" to empty set the backcolor of grc "dng" to blue end if put x into smx put y into smy end mousemove On Tue, Jun 27, 2017 at 4:32 AM, Michael Kristensen via use-livecode < use-livecode@lists.runrev.com> wrote: > Hi there > > How can I determine if the mouse is moving left or right (or up or down) > on the screen in a mouseMove handler? > > Not just from the outset (that is easy) but at any moment, like when a > user changes his mind and move the opposite way. > > Something like put x into oldX will not work. > > Thanks > Michael > _______________________________________________ > use-livecode mailing list > use-livecode@lists.runrev.com > Please visit this url to subscribe, unsubscribe and manage your > subscription preferences: > http://lists.runrev.com/mailman/listinfo/use-livecode > _______________________________________________ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your subscription preferences: http://lists.runrev.com/mailman/listinfo/use-livecode