# Prob Loading Arrays from XML

**URL:** <https://forum.kirupa.com/t/prob-loading-arrays-from-xml/105124>\
**Category:** Uncategorized\
**Created:** [March 23, 2004, 4:29am UTC](https://forum.kirupa.com/t/prob-loading-arrays-from-xml/105124 "2004-03-23T04:29:26Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![gen329](https://avatars.discourse-cdn.com/v4/letter/g/e9bcb4/32.png) [@gen329](https://forum.kirupa.com/u/gen329)\
**Post date:** [March 23, 2004, 4:29am UTC](https://forum.kirupa.com/t/prob-loading-arrays-from-xml/105124/1 "2004-03-23T04:29:26Z")

</div>

I have come across an odd problem. I am making a large scale database (if you can call it that…) by loading information from an XML file into flash. I am using arrays to store the different data and a listbox to select which item that a person may wish to view. Unfortunately the first item that I load will load the name but will not load in data into the arrays… I was wondering what the problem may be?

Heres the code!

//Load xml  
var Progs = new XML();  
Progs.ignoreWhite = true;  
Progs.load(“Programs.xml”);  
//Declare the arrays to hold data  
var details = [na]  
var web = [na]  
var name = [na]  
var cat = [na]  
var image = [na]

//if load works  
Progs.onLoad = function(success) {  
if (success) {  
//repeat as many times as there are nodes in xml  
for (i=0; i\<Progs.childNodes.length; i++)  
{

```
				//add item to list and add parts to arrays
                  list.addItem (this.childNodes*.attributes.name, i);
                  details.push (this.childNodes*.attributes.description)
				  web.push (this.childNodes*.attributes.web)
				  cat.push (this.childNodes*.attributes.category)
				  image.push (this.childNodes*.attributes.picture)
				  list.sortItemsBy ("label", asc)
            }
    }

```

};

list.setSelectedIndex(0);

//If the Scrollbar Changes  
function Change ©{  
//Set all the textfields  
textbox = c.getSelectedItem().label;  
scroller.text = details[c.getSelectedItem().data];  
link = “\<a href=’”+ web[c.getSelectedItem().data] +"’\>" + web[c.getSelectedItem().data] + “\</a\>”;  
categories = cat[c.getSelectedItem().data];  
}

Thank you for any help that you can give me!
