Linking for AS + external as files problem

I’m using a script to load external jpegs from a folder names images and I want to be able to navigate these images with buttons…

I’ve got everything wrking fine but I’m now trying to update the script into an external actionscript file.
My problem is before I used the button script on the button movie clip but now its external I cant seem to define the buttons instance unless I specifically call it MC_Button5 for the fifth button…

I’ve tried a few different ways with no sucess…

varspreads = 10;
varImageLocation = "images";
varSelected = 1;
for (i=0; i<_root.varspreads; i++) {
    _root.attachMovie("MC_Button", "MC_Button"+i, i*10);
    _root["MC_Button"+i]._x = 3+(i*16);
    _root["MC_Button"+i]._y = 400;
    if (i+1 == varSelected) {
        _root["MC_Button"+i].gotoAndStop("selected");
        _root.placeHolder.loadMovie(varImageLocation+"/"+(i+1)+".jpg");
    }
}
function clearSelected() {
    for (i=0; i<_root.varspreads; i++) {
        _root["MC_Button"+i].gotoAndStop("normal");
    }
}
MC_Button.onPress = function() {
    trace("button pressed");
    _root.placeHolder.loadMovie(_root.varImageLocation+"/"+(int(_name.substring(9, 10))+1)+".jpg");
    _root.clearSelected();
    _root["MC_Button"+(int(_name.substring(9, 10)))].gotoAndPlay("selected");
};

Does anyone have any suggestions?

Dave