1 Reply Latest reply on Oct 14, 2006 7:22 AM by DazFaz

    Adding Problem

    The_Real_Ciber
      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?
        • 1. Re: Adding Problem
          DazFaz Level 1
          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);