# \[AS2\]Variables adding wrong

**URL:** <https://forum.kirupa.com/t/as2-variables-adding-wrong/264348>\
**Category:** flash\
**Created:** [June 25, 2008, 7:37am UTC](https://forum.kirupa.com/t/as2-variables-adding-wrong/264348 "2008-06-25T07:37:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![xajin](https://avatars.discourse-cdn.com/v4/letter/x/3d9bf3/32.png) [@xajin](https://forum.kirupa.com/u/xajin)\
**Post date:** [June 25, 2008, 7:37am UTC](https://forum.kirupa.com/t/as2-variables-adding-wrong/264348/1 "2008-06-25T07:37:29Z")

</div>

In my flash movie I define two variables as numbers like

var number1:Number = 1  
var number2:Number = 2

then later on I have it add them together, or at least I’d like to add them together to be the first variable.

number1 = number1 + number2

Instead of them equalling 3, it reads 12. I realize this is because its adding one string after the other and not adding them together as numbers, but how can I fix this?

[edit]  
Fixed my problem. In case anyone else out there is having a similar problem what I did was this

number1 = int(number1 + number2);

and it worked out great.
