# Help with some variables please

**URL:** <https://forum.kirupa.com/t/help-with-some-variables-please/223630>\
**Category:** flash\
**Created:** [April 24, 2007, 3:01pm UTC](https://forum.kirupa.com/t/help-with-some-variables-please/223630 "2007-04-24T15:01:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![badmonur](https://avatars.discourse-cdn.com/v4/letter/b/858c86/32.png) [@badmonur](https://forum.kirupa.com/u/badmonur)\
**Post date:** [April 24, 2007, 3:01pm UTC](https://forum.kirupa.com/t/help-with-some-variables-please/223630/1 "2007-04-24T15:01:44Z")

</div>

Im making an inventory type thing and Im having some touble with my buy button. This is the code I have so far.

```auto

on(press){
 if(_root.gold>=_root.total){
 _root.gold=_root.gold-_root.total;
 _root.shop_inventory=_root.shop_inventory-_root.amount;
 _root.myAmount=_root.myAmount+ _root.amount; //Pissing me off right here.
 _root.inventory.push(_root.ID);
 trace(_root.myAmount);
    trace(_root.inventory);
 trace(_root.gold);
 _root.buy_price=0;
 _root.sell_price=0;
 _root.amount=0;
 _root.ID="";
 this._visible=false;
 
 }else{
  trace("not enough gold");
 }
}
 
Lets say I buy an Item.
When I trace myAmount it gives me 01 and if I buy another item it traces 011. Why is this
I want it to trace 02 but I cant figure out how.

```
