I’m trying to simulate a simple banking swf for a game them I’m starting to build.
WHAT TO USE::::
2 dynamic text boxes - variables set to money & bank
1 input text boxes - variable set to amount
1 button
In the first frame of the game I declare the values that you will start out with.
stop();
money = 500;
bank = 0;
amount = 0;
WHAT I WANT TO DO IS PROBABLY NOT HARD I JUST CAN’T THINK ANYMORE LOL. When you type in an amount into the input put it will subtracted the amount from the MONEY variable and add the amount to BANK, simulating that you’re depositing the cash into your account.
I got the sutraction to work but in the code I’m trying to subtract a variable from a variable and it’s not working… here’s the ACTIONS from the BUTTON
on(press){
if(_root.money >= _root.amount){
_root.money -= _root.amount;
_root.bank += _root.amount;
}
}
_root.bank += _root.amount; <------ This is the line that’s not correct. basically what it’s doing is , let’s say you type is 10 in the amount text box it adds the 10 at the end of the 0 that’s already there so it’s like 0, 010, 01010, 0101010, 010101010 etc etc etc or if you type something else in it’s keeps continuing 01010101050 , 0101010105050, etc etc etc… If anyone could help me , it would be greatly appreciated.
Thanks,
Brent
Studio XI
www.studioxidesign.com