# NaN solution? From adding two variables

**URL:** <https://forum.kirupa.com/t/nan-solution-from-adding-two-variables/288581>\
**Category:** Uncategorized\
**Created:** [May 18, 2009, 2:11pm UTC](https://forum.kirupa.com/t/nan-solution-from-adding-two-variables/288581 "2009-05-18T14:11:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![crift2012](https://avatars.discourse-cdn.com/v4/letter/c/b3f665/32.png) [@crift2012](https://forum.kirupa.com/u/crift2012)\
**Post date:** [May 18, 2009, 2:11pm UTC](https://forum.kirupa.com/t/nan-solution-from-adding-two-variables/288581/1 "2009-05-18T14:11:29Z")

</div>

I need help, and though I have used flash for years professionally, I have not ever used it to add variables specifically for a spreadsheet-like purpose, so any noob advice I will gladly take…because I have only ONE tutorial that remotely comes close to creating a real-time or dynamic spreadsheet. So before I went off and tried to code the whole spreadsheet, I created a function for just two variables which are input boxes on the main timeline addition = {(weeklyOrderFastners),(weeklyOrderHydraulic)} converted the variables to Numbers and changed their variable name for simplicity.

Here is the code that sits on the main timeline.

function OrderTotals () {  
one = Number(weeklyOrderFastners);  
two = Number(weeklyOrderHydraulic);  
weeklyOrderTotal = one + two;  
currentNumOrdersPerWeek = Number(weeklyTotalOrders);

}

And I have this on the parameters on a component button (for testing) action on the stage.

Label=Calculate  
Click Handler=OrderTotals

after I test the movies and put numbers in the variable fields and hit the button it returns a NaN.

So I am stumped I thought I converted the variable to a Number…  
I have many more variables to add, so once again any noob info on this area of actionscript is greatly appreciated…

crift
