Trying to attach functions to as created buttons

hey everyone
im trying to create a series of buttons that will take the user to a link, each link different (obv.). i dont know how many buttons im going to have because im taking in an xml file and from there determining the number of buttons ill need but i need the buttons to go to their own sites. i cant get the buttons to remember where they have to go, they just get stuck on the last 1 through the loop.

for (var i=0; i<linkCounter; i++) {
		var newPictureButton:pictureButton = new pictureButton();
		this.addChild(newPictureButton);

		newPictureButton.x=Math.random()*100;
		newPictureButton.y=Math.random()*50;
		newPictureButton.mcText.text=i+1;
		newPictureButton.name="newPictureButton"+i;
		newPictureButton.value = i;
		
		trace(newPictureButton.value = i);

		buttons*=newPictureButton;
				
		this.buttons*.link.addEventListener(MouseEvent.CLICK, function(e:Event) {clickedButton(buttons*);});
	}
	

function clickedButton(number) {
			trace(linkArray[number]);
			var request:URLRequest=new URLRequest('http://'+linkArray[number]);
			navigateToURL(request);
		}

any ideas?
thanks