# Adding values when pressing a button

**URL:** https://forum.kirupa.com/t/adding-values-when-pressing-a-button/312381
**Category:** flash
**Created:** [August 1, 2010, 8:17pm UTC](https://forum.kirupa.com/t/adding-values-when-pressing-a-button/312381 "2010-08-01T20:17:51Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Chris99](https://avatars.discourse-cdn.com/v4/letter/c/43a26b/32.png) [@Chris99](https://forum.kirupa.com/u/Chris99)
#### Post date: [August 1, 2010, 8:17pm UTC](https://forum.kirupa.com/t/adding-values-when-pressing-a-button/312381/1 "2010-08-01T20:17:51Z")

</div>

Hi,

Im making 6 buttons all with different values. When you press one button the number that button holds will show up in 2 dynamic textfields.

In the first field the numbers will come upp in a list form, one under another.

and in the second textfield the number that the buttons have will add up.

I have tried for some days now but cant come up with anything that worked.

Haved tried with thisfor one button:  
totalsum.text += Number(totalsum.text) + 22;

and this for the next:  
totalsum.text += Number(totalsum.text) + 33;

it works but it places the numbers after another and if you keep klicking the same button the numbers just keep going.

Please, I could really use some help with this… should I use an Array?

Chris
