# The direction my mouse is moving in?

**URL:** https://forum.kirupa.com/t/the-direction-my-mouse-is-moving-in/239375
**Category:** Uncategorized
**Created:** [September 21, 2007, 12:57am UTC](https://forum.kirupa.com/t/the-direction-my-mouse-is-moving-in/239375 "2007-09-21T00:57:36Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lightscience](https://avatars.discourse-cdn.com/v4/letter/l/a88e57/32.png) [@lightscience](https://forum.kirupa.com/u/lightscience)
#### Post date: [September 21, 2007, 12:57am UTC](https://forum.kirupa.com/t/the-direction-my-mouse-is-moving-in/239375/1 "2007-09-21T00:57:36Z")

</div>

hmm…

AS2

i’m tackling the job of making a wheel of symbols, which rotate in a different direction depending on which direction your mouse is moving in (and where your mouse is).

crazy job!

anyway, i was wondering : would anyone happen to have an idea of how you could have flash know what direction the mouse is coming from when it hits an object?

i tried using three setInterval commands like this :

```auto
 
var checkA:Number = setInterval(checkXA, 2);
var checkBStart:Number = setInterval(checkXBStart, 1);
var checkB:Number;
function checkXA():Void
{
 trace("checkXA worked");
 xAMouse = _xmouse;
}
function checkXBStart():Void
{
 checkBStart = setInterval(checkXB, 2);
}
 function checkXB():Void
{
 trace("checkXB worked");
 clearInterval(checkBStart);
 xBMouse = _xmouse;
}

```

the goal of that was to have two variables (a = before, and b = after) so that there’s before and after x variables contantly being redefined… and then later i can say if the x property after is more than the x property before… then rotate clockwise : and vice versa.

WELL that didn’t work. i don’t really quite understand it and i certainly think i could be taking the wrong approach altogether.

if anyone could help me it would be most appreciated!

thanks

silverbirch
