2 Replies Latest reply on May 21, 2006 9:37 AM by Will29

    Actionscript for calculations

    Will29
      I am attempting to develop a flash presentation which will calculate the amount of time/money saved to our customers in using the service we provide. I wanted some (simple?) actionscript to sum values they enter in text boxes. Can anybody point me in the right direction? The idea came from the mortgage shrinker here at : http://www.oneaccount.com/

      Any help would be gratefully received.
        • 1. Re: Actionscript for calculations
          Rothrock Level 5
          Not really anything to it. Just remember that – are you ready for this? – number put into TEXT BOXES are considered text (strings) by Flash.

          So look up partInt() or parseFloat() in the help files to help you change the text to numbers.

          Then basically you will need to read through the help files for the textField class to see what you can use there.

          Finally remember that Flash (like any other binary based system doing decimal math) has the occasional craziness when doing math. So sometimes you will get and answer like 15.000000000001 when you expected 15. There are several threads around here dealing with this. A general solution would be to use Math.round() or some such to make sure the number is as you expect.
          • 2. Re: Actionscript for calculations
            Will29 Level 1
            Many thanks, will give this a try, is there anyone who would consider designing some flash models for a cash reward? I have a few projects which I think are probably beyond my current ability?

            Thanks