3 Replies Latest reply on May 28, 2010 8:59 AM by sebastiantoro84

    change property of component with the propertys name

    sebastiantoro84

      Hi

         I have an application that has a TextArea (id=texto), and also a component that in a certain moment will try to change the TextArea's property "text" to a certain value. In the component I have two strings, one holding the name of the TextArea's property: "text", and the other one with the future new value of that property. What I want to know is how can I change, in the component, the property of the TextArea with only having it's name.

       

      Look at the big line, that kind of shows what I want to do, I know that that's not possible but maybe there is some way you can show me to do what I want

       

      Example Code:

       

      ----Application:

       

                <mx:Text id="texto" width="100%" height="100%" />

       

                <local:Componente id="Principal" />

       

      ----Componente:

       

           <mx:Button  click="clickhandler"/>

       

           <mx:Script>
              <![CDATA[

       

                  private function clickhandler():void {
                          var aux:String = "text";
                          var aux2:String = "Hi this is the new text";                           

                   parentDocument[texto].setPropertyByName(aux) = aux2;

                  }

       

              ]]>

       

          </mx:Script>

       

                       }

       

              ]]>

           </mx:Script>

       

      Thanks for your help

       

      Sebastián Toro O.