# XML Slideshow/Portfolio array value not passing to movie clip

**URL:** <https://forum.kirupa.com/t/xml-slideshow-portfolio-array-value-not-passing-to-movie-clip/234477>\
**Category:** flash\
**Created:** [August 2, 2007, 3:24pm UTC](https://forum.kirupa.com/t/xml-slideshow-portfolio-array-value-not-passing-to-movie-clip/234477 "2007-08-02T15:24:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![blunderbus](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@blunderbus](https://forum.kirupa.com/u/blunderbus)\
**Post date:** [August 2, 2007, 3:24pm UTC](https://forum.kirupa.com/t/xml-slideshow-portfolio-array-value-not-passing-to-movie-clip/234477/1 "2007-08-02T15:24:25Z")

</div>

Hello,  
I’ve adapted Kirupa’s xml portfolio and slideshow to something that works pretty well. But I haven’t been able to get a certain important function to work within a loop. The following script loads the xml file, defines several variables and creates an array. The array variables are assigned within a ‘for’ loop. Then the thumbs are loaded into their correct mc’s using the ‘i’ value. When I try this with the thumb links, the ‘i’ value gets lost and I get back an ‘undefined’ message. I can have it trace the image array and the others but passing the value of the thumb that you click doesn’t work. For instance, if you click thumb[5] (as passed through the loop), it should pass that [5] to the ‘bigimage\_mc’.

Here’s the code. Any help would be greatly appreciated. I’d even be willing to exchange my adaptation (a portfolio with thumbs, swapping big image, and previous/next buttons).

//LOAD XML FILE AND CREATE ARRAYS FROM THE DATA///////////////  
function loadXML(loaded) {  
if (loaded) {  
xmlNode = this.firstChild;  
thumb = [];  
image = [];  
title = [];  
caption = [];  
// VARIABLE COUNTING THE PICTURE NODES  
total = xmlNode.childNodes.length;  
// THE LAST INTEGERS MATCH THE CHILDNODES ORDER IN THE XML CORRESPONDING TO THE VARIABLE NAME  
for (i=0; i\<total; i++) {  
thumb\* = xmlNode.childNodes\*.childNodes[0].firstChild.nodeValue;  
image\* = xmlNode.childNodes\*.childNodes[1].firstChild.nodeValue;  
title\* = xmlNode.childNodes\*.childNodes[2].firstChild.nodeValue;  
caption\* = xmlNode.childNodes\*.childNodes[3].firstChild.nodeValue;  
//LOAD THUMBS. THIS WORKS FINE.  
thumbmenu\_mc[“thumb\_mc”+i].thumbimg\_mc.loadMovie(thumb\*);  
//COULDN’T PASS THE ARRAY VALUE TO THE ‘bigimage’ TARGET WITH ‘onPress’ FUNCTION  
thumbmenu\_mc[“thumb\_mc”+i].onPress = function() {  
bigimage\_mc.picture\_mc.\_alpha = 0;  
bigimage\_mc.picture\_mc.loadMovie(image\*);  
bigimage\_mc.title\_txt.text = title\*;  
bigimage\_mc.desc\_txt.text = caption\*;  
};  
}  
} else {  
content = “file not loaded!”;  
}  
}  
xmlData = new XML();  
xmlData.ignoreWhite = true;  
xmlData.onLoad = loadXML;  
xmlData.load(“paintings.xml”);
