# At least help with this

**URL:** <https://forum.kirupa.com/t/at-least-help-with-this/183019>\
**Category:** Uncategorized\
**Created:** [March 23, 2006, 5:05am UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019 "2006-03-23T05:05:16Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![rpgfan](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rpgfan](https://forum.kirupa.com/u/rpgfan)\
**Post date:** [March 23, 2006, 5:05am UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/1 "2006-03-23T05:05:16Z")

</div>

when ever i put this AS in a button:  
\_root.var+=1  
is adds a “1” not 1 so it looks like this:  
0111111111  
how do i avoid that?

---

<div class="post-metadata">

**Author:** ![dreeft](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@dreeft](https://forum.kirupa.com/u/dreeft)\
**Post date:** [March 23, 2006, 5:19am UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/2 "2006-03-23T05:19:27Z")

</div>

I assume var is a temporary name, as you can’t use ‘var’ as a variable name, as it is reserved.

```auto
 var myvar = 0;

on(press){
_root.myvar+=1;
trace(myvar);
}

```

myvar traces as 1,2,3,4… as I click the button. How are you outputting the text?

---

<div class="post-metadata">

**Author:** ![rpgfan](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rpgfan](https://forum.kirupa.com/u/rpgfan)\
**Post date:** [March 23, 2006, 8:44pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/3 "2006-03-23T20:44:33Z")

</div>

Clipboard Actions: Line 1: Statement must appear within on handler  
var myvar = 0;

nope dont work

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 23, 2006, 8:48pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/4 "2006-03-23T20:48:45Z")

</div>

that is an error not a trace, the line has yet to be executed. You need to do what it says and put it in an on event handler, the “var myvar = 0;” is not within a handler, you can declare this in another place then just inrement it with the button.

You may also want to delcare a datatype when creating the variable:

```auto
var myvar:Number = 0;

```

---

<div class="post-metadata">

**Author:** ![rpgfan](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rpgfan](https://forum.kirupa.com/u/rpgfan)\
**Post date:** [March 23, 2006, 8:50pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/5 "2006-03-23T20:50:55Z")

</div>

it says “ouput” window with 1,2,3,4 how i put that in the variable?

---

<div class="post-metadata">

**Author:** ![rpgfan](https://avatars.discourse-cdn.com/v4/letter/r/51bf81/32.png) [@rpgfan](https://forum.kirupa.com/u/rpgfan)\
**Post date:** [March 23, 2006, 10:24pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/6 "2006-03-23T22:24:54Z")

</div>

plz help? plz?

---

<div class="post-metadata">

**Author:** ![JoshuaJonah](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/joshuajonah/32/1775_2.png) [@JoshuaJonah](https://forum.kirupa.com/u/JoshuaJonah)\
**Post date:** [March 23, 2006, 10:33pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/7 "2006-03-23T22:33:17Z")

</div>

ummm. it’s in the variable already if its tracing

---

<div class="post-metadata">

**Author:** ![dreeft](https://avatars.discourse-cdn.com/v4/letter/d/5f9b8f/32.png) [@dreeft](https://forum.kirupa.com/u/dreeft)\
**Post date:** [March 23, 2006, 10:57pm UTC](https://forum.kirupa.com/t/at-least-help-with-this/183019/8 "2006-03-23T22:57:35Z")

</div>

hahaha, yes, as stated, remove the ‘trace’ line and then call ‘myvar’ to get the value.
