# Making dynamic buttons from imported XML

**URL:** <https://forum.kirupa.com/t/making-dynamic-buttons-from-imported-xml/173690>\
**Category:** Uncategorized\
**Created:** [December 28, 2005, 5:46pm UTC](https://forum.kirupa.com/t/making-dynamic-buttons-from-imported-xml/173690 "2005-12-28T17:46:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sparky\_J](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Sparky\_J](https://forum.kirupa.com/u/Sparky_J)\
**Post date:** [December 28, 2005, 5:46pm UTC](https://forum.kirupa.com/t/making-dynamic-buttons-from-imported-xml/173690/1 "2005-12-28T17:46:59Z")

</div>

Hello,  
I’ve been trying to set this up for a couple days. When functioning properly, this file should update the displayed information according to the date. The raw data is imported from an XML file.

Some days will have links and some days won’t, on the days that have links I want actionscript to make buttons for the links. So far I can create the buttons, but all the links and buttons are the same as the last link in the list.

The basic code follows:

```auto

if (links* != 0) {
				  for (k=0; k<linksLength; k++) {
				   var link_mc = date_mc.duplicateMovieClip("link_mc"+k, this.getNextHighestDepth());
				   link_mc._x = 410;
				   link_mc._y = newY+=15;
				   link_mc.beginFill(0xFF00FF, 100);
				    link_mc.lineStyle(1, 0x000000);
					link_mc.lineTo(0,0);
					link_mc.lineTo(200, 0);
					link_mc.lineTo(200, 20);
					link_mc.lineTo(0, 20);
					link_mc.lineTo(0,0);
					link_mc.endFill();
					link_mc._alpha = 10;
					
					this.createTextFields(0,0,"link_txt"+k,300);
				    var newLink = ["link_txt"+k];
				   newLink.htmlText.html = true;
				   newLink.htmlText.border = true;
				   newLink.htmlText = links*[k];
				   newLink.htmlText._y = newY+=10;
				   newLink.htmlText._x = 0;
				   var newText = links*[k];
				   newLink._y = link_mc._y;
				   link_txt0._x = link_mc0._x;
				   link_txt0.htmlText = newText;
				   link_txt1._y = 275;
				   link_txt1.htmlText = newText;
				   newLink.htmlText = links*[k];
				   		 trace(link_mc);
						 trace(newText);
						link_mc.onRelease = function () {
							getURL(newText);
						trace(link_mc);
						trace(newText);
				   }

```

I attached the fla and xml file.
