Difference between writing doFunction; and doFunction();

I was writing a simple app, basically a listener that calculated the distance of the mouse from a movieclip…However the calculation function only started working properly once I wrote the doFunction(); part as doFunction; -without the brackets.

before that, it would calculate it once and not trace the distance again,

after removing brackets, it traced value whenever the mouse moved (how I wanted it)

I’m glad it’s working, but would like to know the reason for this difference…Here is the code:

distanceListen=new Object();


distanceListen.onMouseMove = distanceCalc;

function distanceCalc(){

//mouse pos from square
xdist = Math.round(_xmouse - squaremc._x-15);
ydist = Math.round(_ymouse - squaremc._y-15);

//calc dist using basic trig
distancefromthis = Math.round(Math.sqrt((xdistxdist) + (ydistydist)));

//and trace distance value