9 Replies Latest reply on May 14, 2009 3:16 PM by Michael Borbor

    Displaying XML in Dynamic Text Box

    HEInc08-CUULLp

      OK, I am having a difficult time finding a solution to my problem. I am new to Flex and ActionScript but have just enough knowledge to make me dangerous.

       

      What I am trying to do is display text from an XML file in a dynamic text box after going through several ComboBoxes to narrow the results. SOunds easy, right? Well, I can get the proper text to display, which consists of several individual lines of text, but can seem to be able to figure out how to display only one line of text per line. In other words, I want it to display like a list but need it to display in a text box.

       

      Here is a snippet of my XML code:

       

      <state id="CA" name="California">
           <counties>
                <county name=" Alameda " fipsIDID="0001">
                  <documents>
                       <document name="Summons and Complaint">
                            <types>
                              <type id="biz" name="Business">
                                <line id="00">Any Authorized Agent over the Age of 18</line>
                             <line id="01">Description: Sex____ Race_____ Age_____ Height_____ Weight_____ Hair_____ Glasses Y/N     </line>
                             <line id="02"> </line>                                     
                                     </type>
                                    <type id="ind" name="Individual">
                                   <line id="00">Must Make 3 Attempts on 3 Seperate Days Before Subserving</line>
                                         <line id="01">Any Person over the Age of 18 Who Resides at Servees Abode</line>
                                  <line id="02">Description: Sex____ Race_____ Age_____ Height_____ Weight_____ Hair_____ Glasses Y/N     </line>                                                                
                                    </type>
                             </types>
                       </document>
                     </documents>               
           </counties>
      
      </state>
      

       

      And here is a snippet of the code I have been using to get it to display in my text box:

       

      <mx:Form y="44" width="488" height="164">
              <mx:FormItem label="State:" fontWeight="bold">
                  <mx:ComboBox id="stateCB"
                          dataProvider="{dp3.state}"
                          labelField="@name" prompt="Choose State" />
              </mx:FormItem>
              <mx:FormItem label="County:" fontWeight="bold">
                  <mx:ComboBox id="countyCB"
                          dataProvider="{stateCB.selectedItem.counties.county}"
                          labelField="@name" prompt="Choose County" />
              </mx:FormItem>
              <mx:FormItem label="Document Type:" fontWeight="bold">
                    <mx:ComboBox id="docCB" prompt="Choose Doc" 
                         dataProvider="{countyCB.selectedItem.documents.document}"
                        labelField="@name"/>
              </mx:FormItem>                   
              <mx:FormItem label="Type of Service:" fontWeight="bold">
                  <mx:ComboBox id="typeCB" prompt="Choose Type"
                            dataProvider="{docCB.selectedItem.types.type}"
                            labelField="@name" click="{getServeRules(docCB, typeCB)}"/>              
              </mx:FormItem>
          </mx:Form>
      
          <mx:TextArea x="10" y="227" width="478" height="179" borderThickness="2" 
                          id="rules" text="{typeCB.selectedItem.line.text()}">
          </mx:TextArea>
      
      

       

      I have been trying numerous things to accomplish what I am after but don't have the experience or the knowledge to get it done. I have tried writing a function but am just not sure what I need to do to make it work. If someone could point me in the right direction, I would greatly appreciate it.