XML Gallery Help

Hi, I am using the base code from the XML Gallery tutorial on kirupa.com.
I have set it up so it uses a movieclip instance instead of thumbnail images.
Currently to show the “selected state” of the thumbnail I am placing overmc over the top of the current thumbnail movieclip - This works fine when the clip is selected with the mouse BUT if the gallery is scrolled through using the keyboard I cant get the over state to work on the current thumb…

Heres my code:

stop();
thumb._visible=0;
overmc._visible = 0;
preloader._visible = 0;
//Function to load XML file
function loadXML(loaded) {
if (loaded) {
xmlNode = this.firstChild;
image = [];
_global.total = xmlNode.childNodes.length;
for (i=0; i<_global.total; i++) {
image* = xmlNode.childNodes*.childNodes[0].firstChild.nodeValue;
thumbnails_fn(i);
}
firstImage();
delay = setInterval(makeThumbs, 500);
//thumbnailContent = total number of thumbnails x width of thumbs
_global.thumbnailContent = _global.total * thumbWidth;
} else {
content = “file not loaded!”;
}
}
xmlData = new XML();
xmlData.ignoreWhite = true;
xmlData.onLoad = loadXML;
xmlData.load(“blender.xml”);
//Create function to recieve keypresses
listen = new Object();
listen.onKeyDown = function() {
if (Key.getCode() == Key.LEFT) {
prevImage();
} else if (Key.getCode() == Key.RIGHT) {
nextImage();
}
};
//Functions for buttons (not needed in this version)
Key.addListener(listen);
previous_btn.onRelease = function() {
prevImage();
};
next_btn.onRelease = function() {
nextImage();
};
/////////////////////////////////////
p = 0;
//on enter frame function loads image into the mainImage movieclip
this.onEnterFrame = function() {
filesize = mainImage.getBytesTotal();
loaded = mainImage.getBytesLoaded();
preloader._visible = true;
if (loaded != filesize) {
preloader.bar._xscale = 100*loaded/filesize;
} else {
preloader._visible = false;
if (mainImage._alpha<100) {
mainImage._alpha += 2;
}
}
};

function nextImage() {
if (p<(total-1)) {
p++;
if (loaded == filesize) {
mainImage._alpha = 0;
mainImage.loadMovie(image[p], 1);
picture_num();
setOverState(“th”+p);
}
}
};

function prevImage() {
if (p>0) {
p–;
mainImage._alpha = 0;
mainImage.loadMovie(image[p], 1);
mainImage_num();
setOverState(“th”+p);
}
};
function firstImage() {
if (loaded == filesize) {
mainImage._alpha = 0;
mainImage.loadMovie(image[0], 1);
mainImage_num();
}
};
function picture_num() {
current_pos = p+1;
pos_txt.text = current_pos+" / "+total;
};
//Function to set over state on thumbnail
function setOverState(thumbClip){
overmc._visible = 1;
thumbClip._alpha = 40;
overmc.swapDepths(10000);
overmc._x = thumbClip._x;
overmc._y = thumbClip._y-2;
};
//Show selected image
function showImage(d) {
if (loaded == filesize) {
mainImage._alpha = 0;
mainImage.loadMovie(image[d]);
p = d;
picture_num();
}
};

function makeThumbs() {
clearInterval(delay);
//Setup thumbnails for first 28 images
for (var i = 0; i<28 && i<image.length; i++) {
var thmb = thumb.duplicateMovieClip(“th”+i, getNextHighestDepth());
thmb.id = i;
thmb._x = thumb._x+(i*12);

    thmb.onRollOver = function(){
        this.gotoAndStop(11);
    }
        
    thmb.onRollOut = function(){
        this.gotoAndStop(10);
    }
    
    thmb.onDragOut = function(){
        this.gotoAndStop(10);
    }
    //On release set over movie clip
    thmb.onRelease = function() {
        showImage(this.id);
        setOverState(this);
    };
}
//Setup thumbnails for next 28 images
for (var i = 28; i&lt;image.length; i++) {
    var thmb = thumb.duplicateMovieClip("th"+i, getNextHighestDepth());
    thmb.id = i;
    thmb._x = -326+(i*12);
    thmb._y = 310+14;
    
    thmb.onRollOver = function(){
        this.gotoAndStop(11);
    }
        
    thmb.onRollOut = function(){
        this.gotoAndStop(10);
    }
    
    thmb.onDragOut = function(){
        this.gotoAndStop(10);
    }
    
    //On release set over movie clip
    thmb.onRelease = function() {
        showImage(this.id);        
        setOverState(this);
    };
}

};