# Looped button functions

**URL:** <https://forum.kirupa.com/t/looped-button-functions/235495>\
**Category:** flash\
**Created:** [August 11, 2007, 10:45pm UTC](https://forum.kirupa.com/t/looped-button-functions/235495 "2007-08-11T22:45:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ambush\_Media](https://avatars.discourse-cdn.com/v4/letter/a/f475e1/32.png) [@Ambush\_Media](https://forum.kirupa.com/u/Ambush_Media)\
**Post date:** [August 11, 2007, 10:45pm UTC](https://forum.kirupa.com/t/looped-button-functions/235495/1 "2007-08-11T22:45:13Z")

</div>

will someone please tell me why this doesnt work. I’ve done this before in similar fashion and its worked fine.

I have a gallery that generates thumbs. I want to make a tooltip on each thumb. If i add this to one button in particular it works fine, but looping it screws it up, i know its a simple syntax issue but am just stupid.

```auto

function buildBtn(btn, num) {
	//trace("built button "+btn);
	btn.onRollOver = function() {
		//tt.showTip(txt[num]);
		trace("hello");
	}
	btn.onRollOut = function() {
		tt.removeTip();
	}
}

while(i<=35) {
	num = i;
	button = "btn"+num;
	//trace(button);
	buildBtn(button, num);
	
	i++;
}

```

so even when i uncomment the trace on the button action nothing happens. its somehow not applying the function to the actual button.

Thanks guys.
