Newbie: eventListeners and functions problem

Hi there,

I have a noob question that annoys me.
I want to calculate the speed of the mouse. For that, I register when the mouse is clicked, get the mouseX, mouseY, and then add an event listener that subtracts the new x,y values from the old, and then I sqrt to get the distance, which is a vector I can use. All good.

But, I am new to AS 3 and I cannot figure out the whole event listeners thing: I write an EnterFrame event that acts as main loop, then I write a MouseEvent that captures the click, and launches another EnterFrame where I calculate the positions. But it doesn’t work - it returns NoN all the time.

I can imagine it is a scope problem, but I am not sure how to fix it - any help will be appreciated.

Thanks!!