Looped button functions

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.

function buildBtn(btn, num) {
	//trace("built button "+btn);
	btn.onRollOver = function() {
	btn.onRollOut = function() {

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

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.