# Incrementing a Variable with buttons

**URL:** <https://forum.kirupa.com/t/incrementing-a-variable-with-buttons/90809>\
**Category:** flash\
**Created:** [May 20, 2005, 9:37pm UTC](https://forum.kirupa.com/t/incrementing-a-variable-with-buttons/90809 "2005-05-20T21:37:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![cheesy\_x](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@cheesy\_x](https://forum.kirupa.com/u/cheesy_x)\
**Post date:** [May 20, 2005, 9:37pm UTC](https://forum.kirupa.com/t/incrementing-a-variable-with-buttons/90809/1 "2005-05-20T21:37:14Z")

</div>

I’ve followed several tutorials on how to do this, but my dynamic text box always returns a value of “Nan” when I try to increment it’s value.  
I’ve been trying to use

```auto
_root.total = _root.total + 1;

```

] in an on release function. Even if i managed to get this to work though, I still need to reuse the variable i’m incrementing within other calculations.

If anyone could show me how to get this working, and re-use the variable. It would be much appreciated.
