14 Replies Latest reply on Apr 17, 2007 2:53 PM by Greg Dove

    Where is the "a" coming from?

    swodiddy Level 1
      Cant figure out where the "a" is coming from. How can I get rid of it? Here is the code:

      And here is the sample: http://home.comcast.net/~shane.swoboda/pro_calc2.html

      --------------------------------------------------------

      salary = "0";
      profactor = "0";

      increasepercent = "0";
      proincpercent = "0";
      prodolinc = "0";
      prosalary = "0";

      increasedollar = "0";
      dolincpercent = "0";
      annualincrease = "0";
      dolsalary = "0";

      daysLabel.autoSize = "left";
      daysLabel.text = "";
      //

      function roundThatNumber(theNumber:Number,thePlaces:Number) :Number
      {
      var theKey:Number=Math.pow(10,thePlaces);
      //trace(theKey);
      theNumber*=theKey;
      //trace(theNumber);
      theNumber=Math.round(theNumber);
      theNumber/=theKey
      return theNumber;
      }

      function formatCurrency(value:Number):String
      {
      var cents:Number = Math.round(value*100);
      var result:String = Math.floor(cents/100) + ".";
      cents %= 100;
      if (cents < 10) {
      result += "";
      }
      result += String(cents);
      return result;
      }


      _root.onEnterFrame = function() {
      asalary = salary;
      aincreasepercent = increasepercent;
      aprofactor = Number(dayslabel.text)/(365);
      proincpercent = Number(aincreasepercent)* Number(aprofactor);
      aprodolinc = Number(asalary)* Number(proincpercent)/(100);
      aprosalary = Number(asalary)+Number(aprodolinc);

      dolincpercent = Number(increasedollar)/Number(asalary)*(100);
      bannualincrease = Number(dolincpercent)/Number(aprofactor);
      bdolsalary = Number(asalary)+Number(increasedollar);


      prosalary = (formatCurrency(aprosalary));
      dolsalary = (formatCurrency(bdolsalary));
      profactor = (roundThatNumber(aprofactor,3))*(100);
      prodolinc = (formatCurrency(aprodolinc));
      annualincrease = (roundThatNumber(bannualincrease,1));



      var loH:Object = new Object();
      loH.change = function(eO:Object) {
      hDate = eO.target.selectedDate;
      d = new Date(2007, 3, 1);
      daysSinceHire = Math.ceil((d.getTime() - hDate.getTime()) / (1000 * 60 * 60 * 24));
      daysLabel.text = daysSinceHire;
      };
      var loE:Object = new Object();
      loE.change = function(eO:Object) {
      eDate = eO.target.selectedDate;
      if (hDate) {
      daysSinceHire = Math.ceil((eDate.getTime()-hDate.getTime())/(1000*60*60*24));
      daysLabel.text = ""+daysSinceHire+"";
      }
      };
      effdate.selectedDate = new Date(2007, 3, 1);
      hiredate.addEventListener("change", loH);
      effdate.addEventListener("change", loE);v
      };