11 Replies Latest reply on Feb 3, 2011 4:39 PM by learner_doug

    XML feeding TextArea and Tooltips

    learner_doug Level 1

      I'm finding that many of the textareas/tooltips in this application are repeating.  Is there a way to set up an XML "database" to pull text into these areas in the various components that use them repeatedly?

      Thanks.

        • 1. Re: XML feeding TextArea and Tooltips
          Flex harUI Adobe Employee

          I don't understand the question.

          1 person found this helpful
          • 2. Re: XML feeding TextArea and Tooltips
            learner_doug Level 1

            Data:

             

            1.  Work Description A

            1a. ToolTip text for Work Descript A

             

            2.  Work Description B

            2a. ToolTip text for Work Description B

             

            3.  Work Description C

            3a. ToolTip text for Work Description C

            • 3. Re: XML feeding TextArea and Tooltips
              learner_doug Level 1

              Continued - I accidently posted without finishing...

               

              Data:

               

              1.  Work Description A

              1a. ToolTip text for Work Descript A

               

              2.  Work Description B

              2a. ToolTip text for Work Description B

               

              3.  Work Description C

              3a. ToolTip text for Work Description C

               

               

               

               

               

               

              <mxlm file component>

              <s:TextArea id="wkA" />

              <s:TextArea id="wkB" />

              <s:TextArea id="wkC" />

              • 4. Re: XML feeding TextArea and Tooltips
                Flex harUI Adobe Employee

                I still don't understand.  There is no XML in your example.

                1 person found this helpful
                • 5. Re: XML feeding TextArea and Tooltips
                  learner_doug Level 1

                  Thanks for your persistance.  A simplified example:

                   

                  __________________XML File __________________________________

                  <?xml version="1.0" encoding="utf-8"?>

                  <items>

                    <item>

                       <description>Text A goes here</description>

                       <toolTip>ToolTip A text goes here</toolTip>

                    </item>

                    <item>

                       <description>TextB goes here</description>

                       <toolTip>ToolTip B text goes here</toolTip>

                    </item>

                  </items>

                  __________________________ Component ___________________

                  <componentA>

                   

                  <s:textArea id="txtA" />

                  <s:textArea id="txtB" />

                   

                  </componentA>

                   

                  __________________________________________________________

                  I'd like the XML data above to populate the textAreas below.  I actually have hundreds of these in about fifty components - many are repeating.

                  • 6. Re: XML feeding TextArea and Tooltips
                    Flex harUI Adobe Employee

                    In model/view or MVC, the XML file becomes the data model.  The various

                    component instances hook up to the data model.  Are you expecting to have

                    some mapping of id to nodes in the XML?

                     

                    If each item had an id attribute, then each textarea could search for that

                    item that matches its id.

                     

                    What is your plan for the mapping?

                    • 7. Re: XML feeding TextArea and Tooltips
                      learner_doug Level 1

                      I'd like each item (is that called a node?) in the XML file to map to a specific TextArea.  And the I'd like each XML "record" or node to be re-usable from any number of TextAreas throughout the application.  The XML file would act as a database of textual data, and eventually attribute/property information. But I'd like to get the text functionality working first. 

                       

                      XML____________________________________________________

                      <items>

                        <item id="1">

                           <text>This is item 1 text</text>

                           <toolTip>This is item 1's tooltip text</toolTip>

                        </item>

                       

                        <item id="2">

                           <text>This is item 2 text</text>

                           <toolTip>This is item 2's tooltip text</toolTip>

                      <items>

                       

                      _______________________________________________________

                      Then each TextArea below would get its text from a specific item above

                       

                      MXML__________________________________________________

                      <s:TextArea id="ow1" />    //this would get its text from id=1

                      <s:TextArea id="ow2" />   //this would get its text from id=2

                       

                      Thank you.

                      • 8. Re: XML feeding TextArea and Tooltips
                        learner_doug Level 1

                        By the way, I currently assign text and tooltip-text to variables and then assign the variables as properties of the TextAreas:

                         

                        AS file_____________________________________

                        var ow1Text:String = "Some text for item A";

                        var ow1toolTip:String = "Some text for ToolTip A";

                        var ow2Text:String = "Some text for item B";

                        var ow2toolTip:String = "Some text for ToolTip B";

                         

                        ow1.Text = ow1Text;

                        ow1.toolTip = ow1toolTip;

                        ow2.text = ow2Text;

                        ow2.toolTip = ow2toolTip;

                         

                        MXML file__________________________________

                        <s:TextArea id="ow1" />

                        <s:TextArea id="ow2" />

                        • 9. Re: XML feeding TextArea and Tooltips
                          learner_doug Level 1

                          Also,

                          I know how to bring in XML text for the drop-down list using httpservice.  It seems that all of the XML examples/tutorials explain how to use XML with lists and datagrids, but none for non-list text areas.

                          • 10. Re: XML feeding TextArea and Tooltips
                            Flex harUI Adobe Employee

                            I understand your goal, the key thing will be the mapping, which may make a

                            big difference in how you code it.

                             

                            For now, if you have some Singleton:

                             

                            Public class MyXMLSingleton

                            {

                                public static var items:XML =

                            <s:TextArea id="ow2" text="{MyXMLSingleton.items.item.(@id==2).toString()"

                            /

                            • 11. Re: XML feeding TextArea and Tooltips
                              learner_doug Level 1

                              Hmmm - I'm going to try this.

                              Thanks.