# \[FMX\] using script in buttons to change variables

**URL:** <https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482>\
**Category:** Uncategorized\
**Created:** [May 27, 2004, 10:56am UTC](https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482 "2004-05-27T10:56:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Boondogger](https://avatars.discourse-cdn.com/v4/letter/b/e274bd/32.png) [@Boondogger](https://forum.kirupa.com/u/Boondogger)\
**Post date:** [May 27, 2004, 10:56am UTC](https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482/1 "2004-05-27T10:56:02Z")

</div>

I’m trying to use actionscript in a button to increment variables in my program. ie. when you click the button it increments a variable and so displays different information in one of my dynamic text boxes. The program doesn’t seem to recognise the button input. I understand you have to give your button an instance name but I’m not sure how to set up the code to recognise this input.  
The code in my button is on (release) {  
buttonup++;}  
This is meant to increment a variable of that name but doesn’t appear to work.  
Any suggestions would be very welcome.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 27, 2004, 12:53pm UTC](https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482/2 "2004-05-27T12:53:46Z")

</div>

right after that put this,

trace(buttonup);

if in your output window it works, then it’s a problem with your dynamic text box.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 28, 2004, 1:46pm UTC](https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482/3 "2004-05-28T13:46:56Z")

</div>

seems to me is as tho oyu haven;t declared the original value so in ur first frame declare buttonup = 1 or so

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [May 28, 2004, 7:15pm UTC](https://forum.kirupa.com/t/fmx-using-script-in-buttons-to-change-variables/111482/4 "2004-05-28T19:15:58Z")

</div>

Yup. Got it now. Thanks for that.
