0 Replies Latest reply on Jul 23, 2009 8:10 AM by chieffan

    1120 Error using IF

    chieffan Level 1

       

       

       

       

       

       

       

       

       

      I am pretty new to Flex and came across this error.  I know if If I move the variables outside the privatefunction this works, but I need them in there to make the time run.  What I want to do is threw an alert depending on what value is in the timer when the user stops.  So putting the IF statement in the time isnt going to work.  Anyway I can still access these variables inside this function?  Thanks.

       

      private function updateTimer(evt:TimerEvent):void

      {

       

       

      var d:Date = new

      Date(getTimer() - baseTimer);

       

       

      var

      hr:String = (HR_MASK + d.hours).substr(-HR_MASK.length);

       

       

      var

      min:String = (MIN_MASK + d.minutes).substr(-MIN_MASK.length);

       

       

      var

      sec:String = (SEC_MASK + d.seconds).substr(-SEC_MASK.length);

       

      counter.text = String(hr +

       

      ":" + min + ":"

      +

       

      sec);

       

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

       

      private function stopTimer():void {

      t.stop();

       

      if(min>threequarters){

      Alert.show(

      "3/4");

      }

      else if(min>half){

      Alert.show(

      "1/2");

      }

      else if(min>quarter){

      Alert.show(

      "1/4");

      }

      }