views:

38

answers:

1

Hi all, I'm logging the mouse movements in a web app.

I'd like to detect the mouse acceleration on a platform (e.g. Windows). Is it possible to do it from javascript, even just in an approximated way? I could ask the user to check their settings with a questionnaire, but it would be much better to detect it automatically.

Cheers

A: 

Check distance the mouse has moved over a set interval of time:

var mX:Number = _xmouse;
var mY:Number = _ymouse;

function checkDistance()
{
    clear();
    //trace('new distance: ' + Math.sqrt(Math.pow((mY - _ymouse), 2) + Math.pow((mX - _xmouse), 2)));
    lineStyle(1, 0x000000);
    moveTo(mX, mY);
    lineTo(_xmouse, _ymouse);
    mX = _xmouse;
    mY = _ymouse;
}

setInterval(checkDistance, 1000);

from http://www.kirupa.com/forum/showthread.php?t=332961

Emile