# How to pass variable?

**URL:** <https://forum.kirupa.com/t/how-to-pass-variable/186272>\
**Category:** Uncategorized\
**Created:** [April 20, 2006, 6:37am UTC](https://forum.kirupa.com/t/how-to-pass-variable/186272 "2006-04-20T06:37:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 20, 2006, 6:37am UTC](https://forum.kirupa.com/t/how-to-pass-variable/186272/1 "2006-04-20T06:37:31Z")

</div>

hi, I want to pass a selectedIndex as a variable over to another function so that the loop will follow whatever is being selected in the list.  
I’ve tried using return variable;  
it doesn’t seem to be working though

I would like to loop the images in the following function by following the ‘count’ variable from the video playback.

for (var q=0; q\<total; q++) {

image[q] = xmlNode.childNodes[count].childNodes[1].childNodes[q].firstChild.nodeValue;  
image3[q] = xmlNode.childNodes[count].childNodes[2].childNodes[q].firstChild.nodeValue;  
messages[q] = xmlNode.childNodes[count].childNodes[3].childNodes[q].firstChild.nodeValue;

}

firstImage();

} else {

content = “file not loaded!”;

}

}

This is the video playback loop. Is it possible to loop the above image slidesshow function using the index of the video? Such as When video 1 is playing, I use the video index of 1 for the image slideshow to know which image it should show.

vidList.complete = function() {  
if(seq.selected) {  
if(count == list.length-1){  
count = 0;

```
    }
    else {
        count++;

    }

}
else {
    var temp = count;
    while(temp == count) {
    count = Math.floor(Math.random()*list.length);
    }
}
    
vid.play(list.getItemAt(count).data);
list.selectedIndex = count;
list.getSelectedIndex(); 
trace(count);

```

}

really appreciate any help here. Thank you.

---

<div class="post-metadata">

**Author:** ![seraphangel](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/seraphangel/32/2354_2.png) [@seraphangel](https://forum.kirupa.com/u/seraphangel)\
**Post date:** [April 20, 2006, 4:05pm UTC](https://forum.kirupa.com/t/how-to-pass-variable/186272/2 "2006-04-20T16:05:46Z")

</div>

anyone with any ideas?  
please help.
