# Buttons in an array and loading corresponding swf?

**URL:** <https://forum.kirupa.com/t/buttons-in-an-array-and-loading-corresponding-swf/181096>\
**Category:** flash\
**Created:** [March 6, 2006, 1:46pm UTC](https://forum.kirupa.com/t/buttons-in-an-array-and-loading-corresponding-swf/181096 "2006-03-06T13:46:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flashwillkill](https://avatars.discourse-cdn.com/v4/letter/f/3d9bf3/32.png) [@flashwillkill](https://forum.kirupa.com/u/flashwillkill)\
**Post date:** [March 6, 2006, 1:46pm UTC](https://forum.kirupa.com/t/buttons-in-an-array-and-loading-corresponding-swf/181096/1 "2006-03-06T13:46:52Z")

</div>

Hello Kirupians,  
Trying to set my main buttons, which work sort of.  
The prob is: “this.id” is interpreted as that and flash is trying to load this.id.swf.?  
If I substitute the “this.id” before the container.play(); with fe. “gal2”, it loads  
gal2.swf.??  
Anyone knows how to load the appropriate swf to the correlating but?  
It seems my brain died in the process of trying to figure this out :h:  
Thanks in advance for any suggestions.

```auto
butArray = new Array();
butArray = ["gal1", "gal2", "gal3", "gal4", "gal5"];
function mainButtons() {
	for (var i = 0; i<butArray.length; i++) {
		var but = this[butArray*];
		but.id= i;
		but.onRelease = function() {
			disButtons(this.id);
		if (_root.currMovie == undefined) {
        	_root.currMovie = "this.id";
        	container.loadMovie(this.id+".swf");
    	} else if (_root.currMovie != "this.id") {
        	if (container._currentframe >= container.midframe) {
				_root.currMovie = "this.id";
           	 	container.play();
				}
			but.onRollOver = function() {
					this.gotoAndStop(2);
					}
			but.onRollOut = function() {
					this.gotoAndStop(1);
				}
			}
		}
	}
};

```
