# An onMouseDown counter?

**URL:** <https://forum.kirupa.com/t/an-onmousedown-counter/243493>\
**Category:** flash\
**Created:** [November 7, 2007, 4:49pm UTC](https://forum.kirupa.com/t/an-onmousedown-counter/243493 "2007-11-07T16:49:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninjateacup](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@ninjateacup](https://forum.kirupa.com/u/ninjateacup)\
**Post date:** [November 7, 2007, 4:49pm UTC](https://forum.kirupa.com/t/an-onmousedown-counter/243493/1 "2007-11-07T16:49:13Z")

</div>

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.

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

```
