# Incrementing by 1 in dynamic textfield

**URL:** <https://forum.kirupa.com/t/incrementing-by-1-in-dynamic-textfield/137273>\
**Category:** Uncategorized\
**Created:** [February 12, 2005, 9:39pm UTC](https://forum.kirupa.com/t/incrementing-by-1-in-dynamic-textfield/137273 "2005-02-12T21:39:07Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![kleb](https://avatars.discourse-cdn.com/v4/letter/k/5fc32e/32.png) [@kleb](https://forum.kirupa.com/u/kleb)\
**Post date:** [February 12, 2005, 9:39pm UTC](https://forum.kirupa.com/t/incrementing-by-1-in-dynamic-textfield/137273/1 "2005-02-12T21:39:07Z")

</div>

Hello,

I have a movie with a dynamic textbox which has variable name :collide.

This registers collisions between 2 vehicles. I need to make it increment by one for each collision. I have following code which doesn’t work:

\_root.onEnterFrame = function () {

if(car1\_mc.hitTest(car2\_mc) == true) {

```
	n = 1;
	collide = Number(n++);
}

```

}

Could anybody give me the correct code?

Thanks your assistance.  
Kleb
