Copy link to clipboard
Copied
Hi there,
I imagine this to be a simple question, but I don't seem to be able to figure it out being knee deep in code !!
I have this variable :-
var blackCredit = creditBlack.text;
When I try to add or subtract 1 from the amount in the text box, like this :-
blackCredit += 1;
and then update the text box with the new value :-
creditBlack.text = blackCredit;
It's adding the 1 to the end. i.e. 16 becomes 161, instead of 17..
Thanks for your help guys and sorry for the dumb question !!!
Martin
Copy link to clipboard
Copied
You need to convert String to an integer before applying arithmetic operations, i.e.
parseInt(creditBlack.text)
Copy link to clipboard
Copied
great when I've created blackCredit I've simply changed it to
var blackCredit = parseInt(gamePage.blackPot.creditBlack.text);
Seems to work great.. so now to get to my next problem
Thanks for your help
Find more inspiration, events, and resources on the new Adobe Community
Explore Now