# "for" not working, might be the undefined

**URL:** <https://forum.kirupa.com/t/for-not-working-might-be-the-undefined/162815>\
**Category:** flash\
**Created:** [September 16, 2005, 2:09pm UTC](https://forum.kirupa.com/t/for-not-working-might-be-the-undefined/162815 "2005-09-16T14:09:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![drop2](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@drop2](https://forum.kirupa.com/u/drop2)\
**Post date:** [September 16, 2005, 2:09pm UTC](https://forum.kirupa.com/t/for-not-working-might-be-the-undefined/162815/1 "2005-09-16T14:09:17Z")

</div>

I guys, i an new here in kirupa.

I have this problem with my script.

The duplicate “for” is not starting, it should duplicate the button, but for some reason the first loop is undefined. Maybe you guys can help me out. I am pretty new to all this…

```auto

xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load("images.xml");
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
description = [];
link = [];
total = xmlNode.childNodes.length;
totalPromos = total;
for (i=0; i<total; i++) {
trace(i);
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
description* = xmlNode.childNodes*.childNodes[1].firstChild.nodeValue;
link* = xmlNode.childNodes*.childNodes[2].firstChild.nodeValue;
}
newpos = previous_btn._x-20;
for (loop=totalPromos; loop>=1; loop--) {
trace(newButt);
newButt = b.duplicateMovieClip("b"+loop, loop);
newButt.label = loop;
newButt._x = newpos-newButt._width;
newButt._y = Math.round(Stage.height-newButt._height+5);
newpos = newButt._x;
}
firstImage();
} else {
content = "where is the xml?!";
}
}

```
