Im making an inventory type thing and Im having some touble with my buy button. This is the code I have so far.
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.