Need help with Actionscript

Hi everybody!
I want to load movieclips dynamically, but want to put them in an array so that they will be loaded only once. the loading should occur after pressing the right button and since I want all buttons to use the same procedure, I’ve written a function that does it.
Somehow the movieClip is loaded , but the array values disappear after I leave the function.
can somebody help??
here is my code

PIC = [“openBox3.swf”, “ensof4.swf”];
arr = new Array(3);

function ButtonPress(pos) {
if (arr[pos] == null) {
arr[pos] = _root.createEmptyMovieClip((“container”+String(pos)), 1);
loadMovie(PIC[pos], (“container”+String(pos)));
container._x = 0;
container._y = 0;
} else {
arr[pos].play();
}
}
but.onPress = function() {
ButtonPress(0);
};
but1.onPress = function() {
ButtonPress(1);
};