First, working on jsfiddle is way better than putting code here (even short
examples) because it's interactive and we can help you fix your code.

The short answer here is that the click handler is given an event object as
its argument, not an element. So you are looking for a property called
offsetX on the event, which isn't valid. Try event.target.offsetX or
this.offsetX.

Also, addEvent does not take a 3rd argument.

On Tue, Aug 30, 2011 at 4:51 PM, netSQL <[email protected]> wrote:

> I normally use jssignals(it's great) for events, I am new to mootools,
> but do like it.
>
> Here is my code, it just displays the x/y of the mouse click.
>  var onClick = function (el) {
>    console.log('c',el.offsetX, el.offsetY); }
>
> stageCanvas.addEventListener('click',onClick,false);
> //stageCanvas.addEvent('click',onClick.pass(stageCanvas),false);
>
> addEventListenerworks, addEvent does not. It says 'undefined'.
> I do not want the inaner unnamed function for many reasons, one is not
> testing.
>
> How do I pass an argument to a function w/ MooTools?
>
> Vic
>

Reply via email to