0

I am seeing a strange issue in flex. I need to reset all text input fields to 0 once the user submits the values to be calculated. In the method

     private function calculate():void {
       resetToZero();
       var num:Number = parseFloat(s21.text);    
      }  


     private function resetToZero():void {
      //multiple if statements.... existing here..    
     if(s2l.text.length ==0);
 {  
    Alert.show("length is:" + s2l.text.length);
    s2l.text="0";
 }
}

When I am running the program I am getting the alert - length is 1. How is that it when length is 1 it is entering the if statement?. The behavior is really confusing and need some light on this. Is there any other way to achieve the above functionality?

techzen
  • 2,895
  • 2
  • 22
  • 22

1 Answers1

2

Its because of IF statement, which is terminated

if(s2l.text.length ==0);

Remove ; from end as

if(s2l.text.length==0)

Hopes that helps

Imran
  • 2,906
  • 1
  • 19
  • 20