# Dynamic buttons - Duplicate Movie - XML

**URL:** <https://forum.kirupa.com/t/dynamic-buttons-duplicate-movie-xml/171928>\
**Category:** flash\
**Created:** [December 9, 2005, 11:20am UTC](https://forum.kirupa.com/t/dynamic-buttons-duplicate-movie-xml/171928 "2005-12-09T11:20:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![pete\_zahut](https://avatars.discourse-cdn.com/v4/letter/p/91b2a8/32.png) [@pete\_zahut](https://forum.kirupa.com/u/pete_zahut)\
**Post date:** [December 9, 2005, 11:20am UTC](https://forum.kirupa.com/t/dynamic-buttons-duplicate-movie-xml/171928/1 "2005-12-09T11:20:44Z")

</div>

I’m having a bit of a strange problem:

On my stage I have 2 dummy movieclips that I duplicate and I give the a text value.

As you can see below:

The XML file is build like this:  
\*\* \<gallery name=“XXXX”\>  
\<image src=“imgs/XXXX.jpg”/\>  
\</gallery\>\*\*

[(complet XML file)](http://cmdstud.khlim.be/~jcornelissen/JC/vogels.xml)

So as you can see for the gallery names the duplication works perfectly, but  
for the images not :fight:  
It only shows the last one, but if I trace the names of the duplicated buttons I can see them all 😟

Here is my code:

[AS]  
var my\_xml = new XML();  
my\_xml.ignoreWhite = true;  
my\_xml.onLoad = function(success) {  
if(success) { //xml loaded  
var galleries = this.firstChild.childNodes;  
for(var i=0;i\<galleries.length;i++) {  
var gallery = galleries\*;  
\_root.txt.text += gallery.attributes.name + "  
";  
var images = gallery.childNodes;

```
		//&gt;&gt; MENU &gt;&gt; Title
		duplicateMovieClip(_root.dmyTitel,"titel_" + i,i);
		_root["titel_" + i]._x = 50;
		if(i == 0) {
			_root["titel_" + i]._y = 50;
		} else {
			var a=i-1;
			_root["titel_" + i]._y = (_root["titel_" + a]._y + (_root["titel_" + a]._height + 25));
		}
		_root["titel_" + i].txt.text = gallery.attributes.name;
		
		//&gt;&gt; MENU &gt;&gt; Title &gt;&gt; Number
		var xvalue = 55;
		var yvalue = _root["titel_" + i]._y + 17;
		
		for(var j=0;j&lt;images.length;j++) {
			var image = images[j];
			_root.txt.text += " + " + image.attributes.src + "

```

";

```
			dmyNr.duplicateMovieClip("nummer_" + i + "_" + j,100+i+1);
			_root["nummer_" + i + "_" + j].nr.text = j + 1;
			setProperty(_root["nummer_" + i + "_" + j],_name,"nummer_" + i + "_" + j);
			
			xvalue += j*20;
			
			if(j%3 == 0 && j&gt;0) {
				yvalue += 17;
				xvalue = 55;
			}
			
			setProperty(_root["nummer_" + i + "_" + j],_x,xvalue);
			setProperty(_root["nummer_" + i + "_" + j],_y,yvalue);
			
			trace(_root["nummer_" + i + "_" + j]._name + " : " + xvalue + " : " + yvalue);
			//var url = image.attributes.src;
			//trace("---------------------------- " + url);
			_root["nummer_" + i + "_" + j].onRelease = function() {
				//iiiiieeeek!!!!
				//trace("#### " + _root["nummer_" + i + "_" + j] + " : " + url);
			}
		}
	}
} else trace("Error while loading XML...");

```

}  
my\_xml.load(“vogels.xml”)  
[/AS]

[download FLA](http://cmdstud.khlim.be/~jcornelissen/JC/jc_v1.fla)

Thx for your help…
