30 Jul

AS3 String VS Number

I was accidentally stored numbers as a strings in my objects.
Something like that:

data = {x: "200", y: "100"};

instead of that:

data = {x: 200, y: 100};

So, the problem starts when you try to sum or deduct these “numbers”.
For example,

trace(data.x+90);
Output: 20090
trace(data.x-90);
Output: 110

Leave a Reply

Your email address will not be published. Required fields are marked *