2 Replies Latest reply on Feb 28, 2008 1:44 AM by GerryIsHere

    Multiplication

    GerryIsHere Level 1
      Hi there!

      Here is the whole script of a test document which doesn't work...
      Excuse me but I never used multiplication of variables and I confess how shameful I feel.
      I absolutely don't understand the explanations the Flash Help contains...

      Document contains three Input Fields, a Dynamic Field and a Button.
      Clicking the Button returns NaN !!!

      I thank you in advance for any help.

      Best regards from Old Gerry

        • 1. Re: Multiplication
          rlc5611 Level 1
          Try and trace what is in your text field. You might have a space after the number or something else causing the conversion problem.
          • 2. Multiplication
            GerryIsHere Level 1
            Thanks for your reply!
            Problem was I didn't include the variables in the function.
            Your solution is good and solves the problem.

            Or, I should have write:


            operationFct = function () {
            var a:Number = new Number(field1.text);
            var b:Number = new Number(field2.text);
            var c:Number = new Number(field3.text);
            var res:Number = new Number();
            res = (a * b) + c;
            resultFld.text = res;
            };
            myButton.onRelease = function() {
            operationFct();
            };
            stop();

            Best regards,
            Gerry