all groups > flash actionscript > october 2006 >
You're in the

flash actionscript

group:

Adding Problem



Adding Problem The_Real_Ciber
10/14/2006 2:11:32 PM
flash actionscript: Okay, i'm makeing a bank-like thing, heres the script:

Code:

on (release) {
if (_root.cash>=_root.bankdeposit) {
_root.bankbalance+=_root.bankdeposit
_root.cash-=_root.bankdeposit
} else {
_root.notice = "You can not deposit that much!"
} }


When they type the number to deposit into the box and click +, it changes the
_root.bankdeposit: 0 to 0<what they typed>

So if they type: 1234
With a balance of 50
Shows: 501234 instead of adding them.

How can I fix this?
Re: Adding Problem DazFaz
10/14/2006 2:22:55 PM
Its becuase flash thinks you are trying to put 2 strings together rather than
add 2 numbers together.

Solution:
Make sure you have declared the money amounts as "Numbers" rather than strings.

_root.bankdeposit = Number(varibleHere);
_root.bankbalance = Number(varibleHere);

AddThis Social Bookmark Button