4 Replies Latest reply on Oct 31, 2007 11:04 AM by Bloodshovel

    Detecting a variable change

    Bloodshovel
      Hey everybody!

      I've been trying to figure out how to setup a listener to detect a change in a variable. For instance, lets pretend we have a custom component with the code below. The langType variable is bound to another variable in the main application, and I want it to run the changeLangTxt function whenever the langType variable changes. How do I do this?

      var langType:String = new String("english");
      var helloMsg:String;

      private function changeLangTxt():void{
      if(langType == "spanish"){
      helloMsg = "Hola"l
      }
      if(langType == "english"){
      helloMsg = "Hi There"l
      }
      }