I am trying to load xml data into a List with Flex/MXML. I have a method for getting the XML and putting it into the list (I know that it is reading the data properly) but when I run the application I get this error:
TypeError: Error #1034: Type Coercion failed: cannot convert "User1" to mx.collections.IList.
at Function/<anonymous>()[/Users/Jacob/Documents/Adobe Flash Builder 4.6/App/src/views/MainMenu.mxml:52]
(I deleted some of the error log)
I see that it says that the error is occurring at line 52, which is the following:
<s:List id="xml_list" x="44" y="89" width="232" height="341" dataProvider="{get_xml.lastResult.Array.Item}"></s:List>
I have done some tests and I have realized that the error only occurs when the data to be added is 1 item. If there is more that 1 item then it works perfectly and puts the data in the list.
When the XML has one Item, it looks like this:
<Array>
<Item>Hello</Item>
</Array>
And When the XML has two items, it looks like this:
<Array>
<Item>Hi</Item>
<Item>Hola</Item>
</Array>
So my question is: Is there a way to solve this? Any help is highly appreciated.
Thanks, Jacob