# Make array from external XML

**URL:** <https://forum.kirupa.com/t/make-array-from-external-xml/235241>\
**Category:** flash\
**Created:** [August 9, 2007, 3:37pm UTC](https://forum.kirupa.com/t/make-array-from-external-xml/235241 "2007-08-09T15:37:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nejo31](https://avatars.discourse-cdn.com/v4/letter/n/d2c977/32.png) [@Nejo31](https://forum.kirupa.com/u/Nejo31)\
**Post date:** [August 9, 2007, 3:37pm UTC](https://forum.kirupa.com/t/make-array-from-external-xml/235241/1 "2007-08-09T15:37:23Z")

</div>

Hi,

i have a problem. I would like to retrive xml data from an external file. An than i would collect data from that xml to be compared with some id buttons.

ex. IF (xml output atributte) == (id of button), than dissplay button red, else dissplay blue.

I have no problems till here. This is the array and its conntent.

var dataValues = new Array();  
dataValues[0] = “100”;  
dataValues[1] = “131”;

if i do it manualy, like you see above, it all works fine. The buttons respond to it just fine and have the correct color. But if i try to implement it to a load from the xml file all the buttons stay blue.

I dont know how to set an array in this:

function loadXML(loaded) {

if (loaded) {  
dataValues[42] = this.firstChild.childNodes[0].childNodes[0].firstChild.nodeValue;

// EVEN IF I TRY dataValues[1] = “200” or something. It just doesent work in that function  
}

}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“buttons.xml”);

Please help. Ive been trying all day and no success.
