Assign action to dynamic button

Can anyone please help me with this???

I am creating a dynamic group of buttons based on a string that i pass to flash file. There is no problem creating these buttons (that I do duplicating a movieclip from my library) The question is, that i need these buttons to open another page, all buttons the same, but passing a parameter. How can i assign the action to my buttons?

My frame 1 code is at this moment:

for (i=0; i<totalItems; i++) {
_root.attachMovie(‘loader’, ‘imageLoader’+i, getNextHighestDepth());
_root[‘imageLoader’+i]._x = 132*(i);
_root[‘imageLoader’+i]._y = 1;
_root[‘imageLoader’+i].imageLoader.loadMovie(_root[‘img’+i]);
}

The string that flash receives is something like
totalItems=3&img0=pic01.jpg&id0=01&img1=pic02.jpg&id1=02

and the parameter i want to pass to the new page is the value of ‘id’.

Thanks in advance!