Problem with btn inside an attached MC


I have a problem with an attached MC that I have but I can’t figure out how to handle it.

Here’s the deal, I have a MC with some dynamic text, a mc container and button.
The swf attachs as many MC says a variable that is on an .txt file.

Everything works ok, except, the part of the button. Here I attach part of the code so you can understand me:

i = 0
while (i <= (_root.variables.cantidad)) {
setProperty(this[“cuadro”+i],_y,40*i - 40);
loadMovie(“viejos/pequenas/img” add i add “.jpg”,this[“cuadro”+i].imagen);
this[“cuadro”+i].marca.text = _root.variables[“marca”+i]
this[“cuadro”+i].equipo.text = _root.variables[“equipo”+i]
this[“cuadro”+i].referencia.text = _root.variables[“referencia”+i]
this[“cuadro”+i].yearr.text = _root.variables[“yearr”+i]
this[“cuadro”+i].img.text = _root.variables[“img”+i]
_root[“ulr”+i] = “javascript:openWindow(’” add “viejos/img” add i add “.htm’,” add “‘myNewWindow’, ‘toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=500,height=350,left=40,top=90’)”
this[“cuadro”+i].btn.onRelease = function () {

When I click any of the buttons it always open the img10.htm (if I put for example on the .txt 10 as the required MC to attach, which is in the _root.variables.cantidad in the AS above). I need that each button opens img1.htm, the other img2.htm and so on, but it doesn’t work. I can’t figure out why if the rest of the elements (dynamic texts and images loaded) works ok.

Please somebody help me with this, I don’t know what I’m doing wrong.