Populating a <mx:List> with XML

Ask a Question related to Macromedia Flex General Discussion, Design and Development.

  1. #1

    Default Populating a <mx:List> with XML

    I am trying to do a simple list population with a series of names from a local
    XML file. I'm looking for direction regarding how to pull my element and
    populate the list. Here is the XML and code:

    <Customers>
    <Customer>
    <Name>Stephanie Smith</Name>
    <Phone>(555)296 3505</Phone>
    </Customer>
    <Customer>
    <Name>Jacquelyn Smith</Name>
    <Phone>(555)969 3016</Phone>
    </Customer>
    </Customers>

    The mxml:

    <mx:Model id="iaList" source="statedata.xml"/>

    <mx:List id="list"
    dataProvider="{mx.utils.ArrayUtil.toArray(iaList.C ustomer).Name}" width="130"
    height="100%" multipleSelection="true" />

    When the List code is compiled it tells me there is no property 'Name'. I want
    to pull Name from the XML and populate my list. Any ideas?


    dzlmbq Guest

  2. Similar Questions and Discussions

    1. Error populating list
      Hi! I have a document with two listboxes, one called "lista_firenze" and the other called "lista_toscana". The "lista_toscana" has no problem, the...
    2. Populating an array with a list of values
      I have performed a cfhttp request, the results of which are in a variable called FoundString. Found String consists of a list of website links, I...
    3. Populating three list boxes from the database
      Can anybody help? I need to have three list boxes automatically populating each other, (ie when region is selected from the first listbox, it will...
    4. Dynamical populating a list that can be used as drop down list
      Hi, I have a solution in which a person can be a member of one or more groups. In this case the groups are those used in the protection schema of...
    5. List box not populating fully.
      Hi all, I have encountered a very strange problem on one of my list boxes. When I open the form it is on, the listbox populates correctly based...
  3. #2

    Default Re: Populating a <mx:List> with XML


    <mx:List id="list" dataProvider="{mx.utils.ArrayUtil.toArray(iaList.C ustomer)}" width="130" height="100%" multipleSelection="true" labelField="Name" />

    Beau Scott Guest

  4. #3

    Default Re: Populating a <mx:List> with XML

    Thanks a lot. This code really helped me a lot.
    Preeti Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139