# Selecting values in array in listbox

**URL:** <https://forum.kirupa.com/t/selecting-values-in-array-in-listbox/156632>\
**Category:** Uncategorized\
**Created:** [July 27, 2005, 4:37am UTC](https://forum.kirupa.com/t/selecting-values-in-array-in-listbox/156632 "2005-07-27T04:37:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ozeona](https://avatars.discourse-cdn.com/v4/letter/o/cab0a1/32.png) [@Ozeona](https://forum.kirupa.com/u/Ozeona)\
**Post date:** [July 27, 2005, 4:37am UTC](https://forum.kirupa.com/t/selecting-values-in-array-in-listbox/156632/1 "2005-07-27T04:37:57Z")

</div>

hi

i ran into some trouble with arrays… wonder if anyone can guide me?

I suppose to load a xml into flash n convert it into an array. After which im suppose to place them in listbox so that ppl are able to select them to view different stuff.

Apparently, im unable to get the selected value of the listbox. With this, the users cannot select n the whole thing doesnt work.

With array, im suppose to use getSelectedItem to get the value… but it always ends up in a error “[type function]”

```auto
 
xmlData = new XML(); 
xmlData.ignoreWhite = true; 
xmlData.onLoad = loadXML; 
xmlData.load("../XMLs/features_index.xml"); 
////////////////////////////////////////////////////////////////// 

function loadXML(loaded) { 
if (loaded) { 

xmlNode = this.firstChild; 
image = []; 
description = []; 
f_title = []; 
tawards = []; 
awards_img = []; 

total = xmlNode.childNodes.length; 

for (i=0; i<total; i++) { 
f_title* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue; 
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue; 
image* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue; 
tawards* = xmlNode.childNodes*.childNodes[3].firstChild.nodeValue; 
awards_img* = xmlNode.childNodes*.childNodes[4].firstChild.nodeValue; 
//trace(awards); 

} 
setupFeatureList(); 
firstImage(); 
prevImage(); 
nextImage(); 

} else { 
content = "file not loaded!"; 
} 
} 

////////////////////////////// 
function nextImage() { 
if (p<(total-1)) { 
p++; 
if (loaded == filesize) { 
picture._alpha = 100; 
picture.loadMovie(image[p], 1); 
desc_txt.text = description[p]; 
titleText.text = f_title[p]; 
awards_T.text = tawards[p]; 
awards.loadMovie(awards_img[p], 50); 
picture_num(); 
} 
} 
} 
//////////////////////////// 
function prevImage() { 
if (p>0) { 
p--; 
picture._alpha = 100; 
picture.loadMovie(image[p], 1); 
desc_txt.text = description[p]; 
titleText.text = f_title[p]; 
awards_T.text = tawards[p]; 
awards.loadMovie(awards_img[p], 1); 
picture_num(); 
} 
} 
//////////////////////////// 
function firstImage() { 
if (loaded == filesize) { picture.loadMovie(image[0], 1); 
desc_txt.text = description[0]; 
titleText.text = f_title[0]; 
awards_T.text = tawards[0]; 
awards.loadMovie(awards_img[0], 1); 
picture_num(); 
} 
} 
/////////////////////////// 

function picture_num() { 
current_pos = p+1; 
status_txt.text = current_pos+total; 
} 
/////////////////////////// 

function setupFeatureList() { 
for(var item in f_title){ 
featureList.addItem(f_title[item]); 
trace(featureList.getSelectedItem); 
} 
} 

```

thanks in advance
