Professional Web Applications Themes

Populating a <mx:List> with XML - Macromedia Flex General Discussion

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?...

  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. #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

  3. #3

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

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

Similar Threads

  1. Error populating list
    By bulletta in forum Macromedia Flash Data Integration
    Replies: 0
    Last Post: October 18th, 09:49 AM
  2. Populating an array with a list of values
    By samb1 in forum Macromedia ColdFusion
    Replies: 3
    Last Post: February 21st, 02:45 PM
  3. Populating three list boxes from the database
    By Lamine Darbouche in forum ASP
    Replies: 2
    Last Post: October 8th, 01:34 PM
  4. Replies: 2
    Last Post: September 11th, 07:05 PM
  5. List box not populating fully.
    By Ryan in forum Microsoft Access
    Replies: 2
    Last Post: July 18th, 11:32 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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