2 Replies Latest reply on Jul 5, 2007 10:02 AM by DarthTurtle

    Money system

    DarthTurtle
      I was trying to figure out how to make a money system where after you click on what you want to buy, it subtracts it from your total money, but I cant figure out how to stop if from going into the negatives. Can anyone help me?
        • 1. Re: Money system
          gpimpler
          Is this real money or play money? If real...you might want to look into a more secure way of doing things...it's pretty easy to decompile a .swf. As far as going into the negative, I would assume you would have some action event such as a button press at which you would call some function that checks the cost of the item against your current balance and:

          if( currentBalance < costOfItem) {
          // do not allow transaction to happen
          // throw up some message that you don't have enough funds sucker.
          } else {
          // proceed with checkout
          }

          That's a very simplified version of it...but it should keep you from going into the negative. Maybe I misunderstood though.
          • 2. Re: Money system
            DarthTurtle Level 1
            What would i put where // do not allow transaction to happen ?