14 Replies Latest reply on Feb 26, 2007 2:57 AM by aspidistra

    If Else still not working...help!

    aspidistra
      Hi
      I am trying to get four values to add up and be passed to another frame, but I need to check that the four fields are not empty or add up to less than 100 (percent). For some reason although the four fields add up and the amounts are calculated according to my code - the if else statement does not work !

      It is maybe in the wrong place (although if I move it I get NaN ) for the amounts then...can anyone explain why it is not carried out or how to amend it so it works with the rest of the code??

      thanks
      E
      //Calculates total price, checking for empty field
      //and percentage not adding to 100.

      two_btn.onPress = function() {
      priceTotal_txt.text = Number (field1) + Number (field2) + Number (field3) + Number (field4);
      MyTotal = parseInt(priceTotal_txt.text)/60 * 31;
      MobTot = parseInt (mbcalls_txt.text);
      if ((priceTotal_txt.text == null)||(priceTotal_txt.text <100)){
      gotoAndStop("error");
      }else{
      _root.gotoAndStop (15);}
      };