Regarding the ‘detecting direction of mouse’ tutorial, heres a small cut part:
checkX = function (dx, oldVal, newVal) {
if (oldVal < newVal) {
dir = "right";
} else {
dir = "left";
}
return newVal;
};
this.watch("xdir", checkX);
this.onMouseMove = function() {
xdir = _xmouse;
};
There are 3 arguments (dx, oldVal, newVal) - now what is passing values into these 3 arguments? Doesnt seem like an average function call to me. Especially newVal, what is making newVal figure out the new _xmouse? How does the passing of arguments into your function work?