How can I trace mouse moves and ignore non moves
I have a program that records the mouse position every 300 msec over an approximately 9 minute time period.
However, I need to know the mouse position ONLY when it is not the same as the previous moment (sometimes the user stops to talk. I don't want to record 5 minutes of the same mouse position)
Here's the original program
var drawTimer:Timer = new Timer(300, 500000);
drawTimer.addEventListener(TimerEvent.TIMER, timeSampler);
function timeSampler(evt:TimerEvent):void {
{ trace (+mouseX, "," +mouseY);
}
}
I tried creating a variable to capture the mouse position at a specific moment
var posMouseX:Number= mouseX;
var posMouseY:Number= mouseY;
and to add a conditional statement into the function
if ((mouseX != posMouseX) && (mouseY != posMouseY))
{ trace (+mouseX, "," +mouseY);}
but I am not doing this correctly because I either get all mouse moves or none
Can anyone suggest a better way to do this?
Thanks in advance
