A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: NaN solution? From adding two variables..

  1. #1
    Junior Member
    Join Date
    May 2009
    Posts
    1

    NaN solution? From adding two variables..

    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

  2. #2
    Senior Member realMakc's Avatar
    Join Date
    Oct 2002
    Posts
    927
    probably "weeklyOrderFastners" represents a textfield object, not the value you have entered in it. if that's the case, you should need something like weeklyOrderFastners.text instead.

    any way, this doesnt really have to do anything with M&P, does it?
    who is this? a word of friendly advice: FFS stop using AS2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center