8 Replies Latest reply on Jul 30, 2011 12:48 PM by Francisc

    Flasy values in AS3

    Francisc Level 3

      Hello,

       

      I have this getter and setter:

       

      private var _score:String;
      public function get score():String
      {
          return _score;
      }
      public function set score(value:String):void
      {
          if(value==_score){return;}
          _score=value;
          if(scoreDisplay)
          {
              scoreDisplay.text=_score;
              invalidateSize();
          }
      }

       

      _score is either a string (non-empty) or NULL or '' (empty string).

       

      Why does the code inside the following if statement never get executed?

      When _score is NULL or empty string it shouldn't execute the code inside, but when the score is something like "40" (string, not int) it should, but does not.

       

      if(_score)

      {

         //CODE

      }