PDA

View Full Version : Calling a function attached to an eventListener


mintyjones
11-10-2009, 12:42 AM
Hard to name this thread, as it's hard to describe what I'm asking....give it a go anyway.

I have an eventListener listening for mouse events, which will obviously call a function.

The function being called is expecting a mouse event as a parameter (obviously).

Question is, can I call the same function outwith the eventListener i.e. calling it without a mouse event?

mcmcom
11-10-2009, 01:11 AM
you could - by passing null in the function like

myFunction(null);


if your function needs anything that comes from the event target (ie event.currentTarget) however you will not be able to use it.

hth,
mcm

mintyjones
11-10-2009, 02:04 AM
Noice One!!!!!!!

That's exactly what I'm looking for, and no, the function doesn't require information from the event (luckily).

Thanks for your help!