0 Replies Latest reply on Nov 20, 2007 2:06 PM by jtby

    update text area with bindable var

    jtby
      Hi - I am new to flex - must be missing something easy. I am building a widget with two view states, a default state and an "infoState" - on the infoState view I have a text area set with a variable like this:

      <mx:TextArea htmlText="{protocolText}"/>

      ... when I display the viewstate at runtime, the text area shows the expected text. But then when I change the value of the variable protocolText programatically, the TextArea displayed does not change! Is there a different way to do it?



      <mx:Script>
      <![CDATA[

      [Bindable] private var protocolText:String = "NONE";

      [Bindable] private var protocolCount:Number = 100

      public function setProtocolText():void
      {
      protocolCount = protocolCount + 1;
      protocolText = protocolCount.toString();
      }
      ]]>
      </mx:Script>



      <mx:states>
      <mx:State enterState="{setProtocolText()}" name="{'infoState'}" >
      <mx:RemoveChild target="{buttonBox}" />
      <mx:AddChild>
      <mx:TextArea borderThickness="0" top="100" width="508" height="300" htmlText="{protocolText}"/>
      </mx:AddChild>
      </mx:State>
      </mx:states>

      <mx:HBox id="buttonBox" width="508" height="309">
      <mx:Canvas width="508" height="309" backgroundColor="#eaeaea">
      <mx:Button id="manaul update" label="{protocolText}" click="{setProtocolText()}" x="447.5" y="270"/>