4 Replies Latest reply on Jan 15, 2010 2:21 PM by TechComp

    Changing mxml UIComponents with Actionscript

    TechComp

      Hello,

       

      i´m searching about a way to change the text of labels createtd with Designer by Actionscript. But i try to browse the entire collection to find all used UI-Components.

       

      If i use the debugger, i can see  an mxmlContent Array with all Components but i can´t use theses in Actionscript.

       

      Regards

       

      Thomas

        • 1. Re: Changing mxml UIComponents with Actionscript
          David_F57 Level 5

          Hi,

           

          In designview give your component an ID  for instance  if its a label for surname call it lblSurname.

           

          in actionscript  you then assign a value to the labels text  -  lblSurname.text="mySurname";

           

           

          David.

          • 2. Re: Changing mxml UIComponents with Actionscript
            TechComp Level 1

            Hi David,

             

            thanks for the reply, but that is not, what i want.

            I´m searching about a solution to browse the complete mxml component list in Actionscript.

             

            We will change the labels of all items by runtime with data from a cfc (Coldfusion component) without hard coding the labels in Actionscript. I need a readable collection of all UI-Components to read the id´s, comparinge these with the cfc datasource and change these with other data from this source.

             

            As i say, the Applipcation.mxmlContent (or any Group.mxmlContent) has all these properties. Baut i can´t use mxmlContent in Flashbuilder because i got an error, that this property is not defined instead i can read that in the debugger.

             

            Thomas

            • 3. Re: Changing mxml UIComponents with Actionscript
              rfrishbe Level 3

              I'm a little confused about exactly what you want, but you can get a list of all the children in a component by asking for numElements and using

              getElementAt(index).  You can push that in to an Array or an ArrayCollection or wherever you want.

               

              -Ryan

              1 person found this helpful
              • 4. Re: Changing mxml UIComponents with Actionscript
                TechComp Level 1

                Ryan,

                 

                sorry about my bad english. It´s very difficult for me to explain exactly what i want.

                 

                But your answer was exactly the hint i needed.

                 

                Thanks

                 

                 

                Thomas