3 Replies Latest reply on Mar 3, 2009 4:36 PM by Ned Murphy

    interactive pricing module issue

    yoyojoe-flash
      what is going on here? there seems to be an issue in AS2 and I'm not sure what's at the root of it.

      except for the values 1.1, 2.2, 4.4 and 8.8 I can get all other digit combinations to display in a monetary/currency type format of two decimal places (including *.00 and *.*0). I'm using a TextInput component together with a listener for trial purposes.

      code follows below.

      any thoughts please? thank you :)

      here's the code:-
      function currency(amount:Number):String {
      amount = 100 * amount;
      trace("amount x 100 = " + amount);
      if (amount%100 == 0) {
      trace("hundreds amount = " + amount);
      conclusion = amount/100 + ".00";
      trace("conclusion = " + conclusion);
      return conclusion;
      } else {
      if (amount%10 == 0) {
      conclusion = ((amount/100) + "0");
      trace("tens amount = " + amount);
      trace("conclusion = " + conclusion);
      return conclusion;
      } else {
      conclusion = amount /100;
      trace("zeros amount = " + amount);
      trace("conclusion = " + conclusion);
      return conclusion;
      }
      }
      }

      here's the listener:-
      fieldupdater.change = function(evtObj) {
      trace("evtObj.target.text = " + evtObj.target.text);
      var inputdigits:Number = evtObj.target.text;
      trace("testdigits = " + currency(Number(inputdigits)));
      trace("");
      }

      here's the register:-
      ctiTestField.addEventListener("change", fieldupdater);

      just add a textinput component (called ctiTestField) to the stage and give it a try and you may experience the same trace output; if not please let me know.