Dynamic buttons... please help!

Hi all,

I am dynamically generating little buttons, but I can’t figure out how to assign different “onRelease” values to each one…

here’s the code I have…

for (var i=1; i<images.length; i++){
		dynamicButton = attachMovie("button", "button"+i,i);
		dynamicButton.buttonText = count;
		dynamicButton.onRelease = function(){
			trace(dynamicButton);
		}
	} 

So, if it creates 3 buttons, each with it’s own text (1, 2 and 3), ALL of the buttons will trace “_level0.button3”… sigh.