PDA

View Full Version : [FMX]problem with integer



stimulateme
January 23rd, 2003, 06:46 AM
Now for some reason im havin a problem with some simple thing. I dont know if ive just overlooked something or what.

I have this:
---------------------------------------
total = 500

function bettrue() {
_root.total = _root.total + _root.betmenu.bet;
}

function betfalse() {
_root.total = _root.total - _root.betmenu.bet;
}
-------------------------------------
_root.betmenu.bet is an input text that the user obviously inputs.
Function betfalse works fine but the problem is in Function bettrue.

If total = 500 and bemenu.bet = 100 I get an answer of 500100. Im just wondering if im using the wrong operator. The thing is that BetFalse works fine. I think Its because the + can also be used to add strings together and is making Bettrue act like string rather than an integer.

pom
January 23rd, 2003, 08:07 AM
You're absolutely right :cool: You could do something like this:
a=new String("10");
b=20;
trace (Number(a)+b);pom :asian:

stimulateme
January 26th, 2003, 05:40 AM
thx alot i wasnt sure how to write it
Also can u declare you varible as integers?