# How does the watch function pass on arguments?

**URL:** <https://forum.kirupa.com/t/how-does-the-watch-function-pass-on-arguments/207953>\
**Category:** flash\
**Created:** [November 23, 2006, 2:59am UTC](https://forum.kirupa.com/t/how-does-the-watch-function-pass-on-arguments/207953 "2006-11-23T02:59:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)\
**Post date:** [November 23, 2006, 2:59am UTC](https://forum.kirupa.com/t/how-does-the-watch-function-pass-on-arguments/207953/1 "2006-11-23T02:59:28Z")

</div>

Regarding the ‘detecting direction of mouse’ tutorial, heres a small cut part:

```auto
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?
