# Making a list of an Array

**URL:** https://forum.kirupa.com/t/making-a-list-of-an-array/274340
**Category:** flash
**Created:** [October 28, 2008, 6:20pm UTC](https://forum.kirupa.com/t/making-a-list-of-an-array/274340 "2008-10-28T18:20:11Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Sociapirate](https://avatars.discourse-cdn.com/v4/letter/s/ac91a4/32.png) [@Sociapirate](https://forum.kirupa.com/u/Sociapirate)
#### Post date: [October 28, 2008, 6:20pm UTC](https://forum.kirupa.com/t/making-a-list-of-an-array/274340/1 "2008-10-28T18:20:11Z")

</div>

Hai,

For my work i’m trying to get an Array properly into a text field. The array is being taken out of XML and then turned into the array and fed into a textfield. But it shows up like this:

Name1, Name2, Na  
me4, Name4, Name5

But i want it to show up like

Name1  
Name2  
Name3  
Name4

How could I achieve this?

This is my code:

var xml = new XML();  
xml.ignoreWhite = true;

xml.onLoad = function() {  
var score, name, time, position;  
score = this.firstChild;  
if(score.hasChildNodes()) {  
var name = new Array();  
var time = new Array();  
for(var i = 0; i \< score.childNodes.length; i++) {  
name\* = score.childNodes\*.childNodes[0].childNodes[0].nodeValue;  
time\* = score.childNodes\*.childNodes[1].childNodes[0].nodeValue;  
position = i+1;  
//naam\_txt.text = position + “: " + name + " – " + time + " sec.”  
naam\_txt.text = name;  
tijd\_txt.text = time;  
//trace(score.childNodes\*.childNodes[0].childNodes[0]);  
//trace(position + “: " + name + " – " + time + " sec.”);  
}  
}  
}

xml.load(“tijden.xml”);  
[//xml.load](https://xml.load)(“[http://gigakids.nl/files/save.php](http://gigakids.nl/files/save.php)”);  
/\*var uitslag\_array;  
var scoren\_xml = new XML();  
scoren\_xml.ignoreWhite = true;  
scoren\_xml.onLoad = function(succes){

```
if(succes){
	var score = this.firstChild;
	var name, time, position;
	uitslag_array = scoren.childNodes;
	PopulateLists(uistlag_array);
}else{
	trace("Dat gaat zo niet goed he!")
}

```

}  
scoren\_xml.load(“[http://gigakids.nl/files/save.php](http://gigakids.nl/files/save.php)”);

PopulateLists = function(xml\_array){  
naam\_txt.text = tijd\_txt.text = “”;  
for (var i=0; i\<xml\_array.length; i++){  
name = score.childNodes\*.childNodes[0].childNodes[0];  
time = score.childNodes\*.childNodes[1].childNodes[0];  
var ding = xml\_array\*.attributes;  
naam\_txt.text = ding.name + "  
"  
tijd\_txt.text = ding.time + "  
"  
trace(name + " – " + time + " sec.");  
}  
}\*/

var uitslag\_array  
var xml = new XML();  
xml.ignoreWhite = true;

xml.onLoad = function() {  
var score, name, time, position;  
score = this.firstChild;  
uitslag\_array = score.childNodes;  
if(score.hasChildNodes()) {  
for(var i = 0; i \< score.childNodes.length; i++) {  
var scoren = uitslag\_array\*.attributes;  
naam\_txt.text = scoren.name + "  
“;  
name = score.childNodes\*.childNodes[0].childNodes[0];  
time = score.childNodes\*.childNodes[1].childNodes[0];  
position = i+1;  
naam\_txt.text = name  
tijd\_txt.text = time + " sec.”  
//naam\_txt.text = position + “: " + name + " – " + time + " sec.”  
trace(position + “: " + name + " – " + time + " sec.”);  
}  
}  
}  
xml.load(“[http://gigakids.nl/files/save.php](http://gigakids.nl/files/save.php)”);

Thanks in advance for your help!

And yes, i have searched the forum.

Bye!
