onRelease in for-loop

I have a lot of movieclips named a1 … a45 and would like to create onReleases on them all.
I’ve tried:

for (i=1; i<46; i++) {
(“a”+i).onRelease = function() {
getURL(i+".jpg", “_blank”);
};
}

but it does not seems to work. Any ideas?

Almost there, give this a go. When i do this kind of thing i usually use ‘_root’ but sometimes you can use ‘this’ instead.

for (i=1; i<46; i++) {
_root[“a”+i].onRelease = function() {
getURL(i+".jpg", “_blank”);
};
}

this worked for me!

THANK YOU!