4 Replies Latest reply on Mar 22, 2010 2:51 PM by Bear Travis

    Accessing library component properties

    rcanulla Level 1

      Im having trouble accessing my library components properties... For example, a textInput doesn't have a text property.


      Any thoughts?

        • 1. Re: Accessing library component properties
          rcanulla Level 1

          This is because I was trying to access the wrong property. .textDisplay should do it.

          • 2. Re: Accessing library component properties
            rcanulla Level 1

            Nope.textDisplay is the id of the richTextEditor inside the component. I need to access the text property of the textDisplay object via MXML so I can use dataBinding.


            Any thoughts? Maybe someone besides myself?


            catalyst code view for component

            <?xml version="1.0" encoding="utf-8"?>
            <s:Skin xmlns:s="library://ns.adobe.com/flex/spark" xmlns:fx="http://ns.adobe.com/mxml/2009">
                      <s:State name="normal"/>
                      <s:State name="disabled"/>
                 <s:RichEditableText x="0" y="0" color="#000000" fontFamily="Calibri Bold" fontSize="130" tabStops="S0 S50" text="(Text)" height="109" width="236" heightInLines="1" id="textDisplay"/>



            mxml view


            <local:temp id="temperature" x="185" y="200">



            example of it working in AS3


                 public function init():void {
                      temperature.textDisplay.text = "78.4";
            • 3. Re: Accessing library component properties
              rcanulla Level 1

              Maybe Geters/Setters on the Catalyst side? I could also handle in AS3 with a bunch of more code. I can't imagine that this isn't something that has came up before. Please let me know if you have thoughts.


              Thanks in advance!

              • 4. Re: Accessing library component properties
                Bear Travis Adobe Employee



                Could you explain to me what you are trying to do? It looks like you have a custom component called temp, which contains a TextInput. You want to bind a property of temp (say we call it "tempText") to some variable. When the variable is set, you want the text in the TextInput set to the variable's value.


                Is this correct?


                To do this, you would create a getter / setter in your custom component temp, say "tempText", which would access the text input's text property. On your mxml instance, you would write:


                <local:temp ... tempText="{variable}" />


                [edit] You'd have to make these modifications in Builder, since Catalyst will not allow you to modify the code.