0 Replies Latest reply on Apr 2, 2007 7:19 AM by wendiwebgirl

    combobox will not reset when using decimal script

      I have a combobox which should reset when the user changes the selection however when I use a script on the previous frame (using simple reset btn) the combobox will not reset the value. The script I use for decimal is

      Math.formatDecimals = function (num, digits) {
      //if no decimal places needed, we're done
      if (digits <= 0) {
      return Math.round(num);
      //round the number to specified decimal places
      //e.g. 12.3456 to 3 digits (12.346) -> mult. by 1000, round, div. by 1000
      var tenToPower = Math.pow(10, digits);
      var cropped = String(Math.round(num * tenToPower) / tenToPower);
      //add decimal point if missing
      if (cropped.indexOf(".") == -1) {
      cropped += ".0"; //e.g. 5 -> 5.0 (at least one zero is needed)

      //finally, force correct number of zeroes; add some if necessary
      var halves = cropped.split("."); //grab numbers to the right of the decimal
      //compare digits in right half of string to digits wanted
      var zerosNeeded = digits - halves[1].length; //number of zeros to add
      for (var i=1; i <= zerosNeeded; i++) {
      cropped += "0";

      if I delete this code from the page with the reset btn NO PROBLEM but when I add the script for decimal problem??? What am I missing - I am fairly new to actionscript obviously however I am eager and quick to learn. Please Help this is driving me nuts