# Dynamic buttons

**URL:** <https://forum.kirupa.com/t/dynamic-buttons/55009>\
**Category:** flash\
**Created:** [June 20, 2004, 12:04am UTC](https://forum.kirupa.com/t/dynamic-buttons/55009 "2004-06-20T00:04:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raf\_Vervink](https://avatars.discourse-cdn.com/v4/letter/r/e19adc/32.png) [@Raf\_Vervink](https://forum.kirupa.com/u/Raf_Vervink)\
**Post date:** [June 20, 2004, 12:04am UTC](https://forum.kirupa.com/t/dynamic-buttons/55009/1 "2004-06-20T00:04:48Z")

</div>

After reading a tutorial on kirupa and aditional options at this forum, i wanted to make an image gallery were the number of buttons that apear changes as there are more or less images in the image directory.  
So if i have 2 images, there should be 2 buttons.

I’ve tried this, but… it doesn’t work.

This is the code i used:

```auto

var sPlace:String = "images/";
lv = new LoadVars();
lv.onLoad = function(success) {
	if (success) {
		pArray = this.imgList.split(", ");
		for (var i = 0; i<pArray.length-1; i++) {
			_root.mcHolder.attachMovie("mcSquare", "mcSquare"+i, _root.getNextHighestDepth());
			_root.mcHolder._x += i*100;
		}
	} else {
		info.text = "could not load file";
	}
};
lv.load("filearray.php");

```

The result i get is that 1 button is displayed, altough he does the loop several times.

Best regards,  
Raf  
(first time poster, long time reader :thumb: )
