Advanced(:-/) if statements help

i have a things that makes boxes random colors and when u hover over them they pick a diff random color, and if u press them they change to a given color. i want to have it so that if u click a box(or its a given color(the one it changes to on press)), if u hover over it again it wont change. this is what i got without the if statements

for (i in boxes) {
    _root["box_"+i].onRollOver = function() {
        new Color(this).setRGB(cols[random(cols.length-1)]);
    };
    _root["box_"+i].onPress = function() {
        new Color(this).setRGB(cols[(cols.length)]);
    };
}

i know its sumthin probably real simple. im not a noob to flash im actually pretty good, but i am new and i just dont know everything. lol