Simplification of Code

I’m working on a project at the moment using AS 2.0 in which 30 movieClips are contained within another movieClip, and each one is selectable. When an object is selected it has to go to another frame, and any object that was already selected has to become deselected - reverting back to it’s original state.

At the moment I have a hideously long and inefficient piece of code doing the job temporarily, but I need a little help making it simpler please.

Each one of the objects when clicked changes the value of the variable ‘selec’ and then this monstrosity runs every frame:

if (_root.selec == 1) {
        _root.main.house1.gotoAndStop(2);
        _root.main.house2.gotoAndStop(1);
        _root.main.house3.gotoAndStop(1);
        _root.main.house4.gotoAndStop(1);
        _root.main.house5.gotoAndStop(1);
        _root.main.house6.gotoAndStop(1);
        _root.main.house7.gotoAndStop(1);
        _root.main.house8.gotoAndStop(1);
        _root.main.house9.gotoAndStop(1);
        _root.main.house10.gotoAndStop(1);
        _root.main.house11.gotoAndStop(1);
        _root.main.house12.gotoAndStop(1);
        _root.main.house13.gotoAndStop(1);
        _root.main.house14.gotoAndStop(1);
        _root.main.house15.gotoAndStop(1);
        _root.main.house16.gotoAndStop(1);
        _root.main.house17.gotoAndStop(1);
        _root.main.house18.gotoAndStop(1);
        _root.main.house19.gotoAndStop(1);
        _root.main.house20.gotoAndStop(1);
        _root.main.house21.gotoAndStop(1);
        _root.main.house22.gotoAndStop(1);
        _root.main.house23.gotoAndStop(1);
        _root.main.house24.gotoAndStop(1);
        _root.main.house25.gotoAndStop(1);
        _root.main.house26.gotoAndStop(1);
        _root.main.house27.gotoAndStop(1);
        _root.main.house28.gotoAndStop(1);
        _root.main.house29.gotoAndStop(1);
        _root.main.house30.gotoAndStop(1);
    } else if (_root.selec == 2) {
        _root.main.house1.gotoAndStop(1);
        _root.main.house2.gotoAndStop(2);
        _root.main.house3.gotoAndStop(1);
        _root.main.house4.gotoAndStop(1);
        _root.main.house5.gotoAndStop(1);
        _root.main.house6.gotoAndStop(1);
        _root.main.house7.gotoAndStop(1);
        _root.main.house8.gotoAndStop(1);
        _root.main.house9.gotoAndStop(1);
        _root.main.house10.gotoAndStop(1);
        _root.main.house11.gotoAndStop(1);
        _root.main.house12.gotoAndStop(1);
        _root.main.house13.gotoAndStop(1);
        _root.main.house14.gotoAndStop(1);
        _root.main.house15.gotoAndStop(1);
        _root.main.house16.gotoAndStop(1);
        _root.main.house17.gotoAndStop(1);
        _root.main.house18.gotoAndStop(1);
        _root.main.house19.gotoAndStop(1);
        _root.main.house20.gotoAndStop(1);
        _root.main.house21.gotoAndStop(1);
        _root.main.house22.gotoAndStop(1);
        _root.main.house23.gotoAndStop(1);
        _root.main.house24.gotoAndStop(1);
        _root.main.house25.gotoAndStop(1);
        _root.main.house26.gotoAndStop(1);
        _root.main.house27.gotoAndStop(1);
        _root.main.house28.gotoAndStop(1);
        _root.main.house29.gotoAndStop(1);
        _root.main.house30.gotoAndStop(1);
    }

…and so on in that fashion for another 28 iterations.

I know the must be a way to do it with a nice easy ‘for (var houseNo = 1; houseNo <= 30, houseNo++’ deal, but I can’t for the life of me figure out the right syntax.

Any help?

Thanks!