Array and function?

This code works fine for loading a pic into a created container and placed centered in a box_mc.
I am trying with no luck to have the same thing repeat itself x number of time.
My idea is:
array=[1, 2, 3];
var a = 0;
if (a< array.length){ a++;}
then apply the underneath code until a = array.length
changing all the 1 with the value of a, so to load each pic1,2 and 3 in different box_mc1, 2, 3 (still being centered).

createEmptyMovieClip("container1", 1);
function preload1(pic1) {
loaded = pic1.getBytesLoaded();
total = pic1.getBytesTotal();
if (loaded>=total && loaded>0) {
w1 = pic1._width;
h1 = pic1._height;
container1._x = box_mc1._x+(box_mc1._width-w1)/2;
container1._y = box_mc1._y+(box_mc1._height-h1)/2;
loadMovie("pic1.jpg", "container1");
myinterval1 = setInterval(preload1, 50, container1);

PS:I did read many post about XML but would like to stick to AS. I am trying to learn one thing at the time.:to:
Thank you.