An onMouseDown counter?

Basically, I want to make it so when the mouse is down a counter variable increases by 1 until the mouse is released.

Can anyone give me a little tutorial on how I achieve this?

I’ve got this so far, but adding loops to my onMouseDown function causes Flash to go bonkers.

     _root.onMouseDown = function(){
             _root.gravity ++;
     }