tags:

views:

81

answers:

2

I'm totally new to Flex (moving away from Java for now :().

I have an XML file, I read the data and want to add it to a List and then use the List to be displayed.

Something like this is what I want to do:

List data = new ArrayList();

data.add(item1); data.add(item2);

How can I do this, also how will I display the List in a table!!

A: 

Your question is rather... vague.

In Flex there are multiple ways to read data from XML and display it. One approach would be using a HttpService to read the XML. Then you can loop through the data manually or serve it as a DataProvider for a DataGrid.

I suggest you take a look at the Flex documentation, flexexamples.com and the flex quickstart. Topics that could help you:

MysticEarth
MysticEarth, your point is accepted, but I need to update an array/List with data, how can I do that without using Datagrid?
Panther24
A: 

Nerver mind folks, I figured it out myself :)

var hostList : Array=[]; var i: int = numberOfHosts;

   var hostNames: XMLList = hostPointXMLList.elements("HostName");

   for (i=0; i< hostNames.length(); i++) {
    //Alert.show("num="+i+" Hostname="+hostNames[i]);
    hostList[i] = hostNames[i];
   }
Panther24