Detecting multiple instances of a MC

Ok so I want to do a collision detection for a bunch instances of a single movie clip. So I got this movieclip called “map1”. Inside “map1” there are a bunch of rectangles called “house1”. I also have a character whose name is mainChar1. So I know how to do the collision detection for each house individually, but i need a way to do it with some kind of a LOOP because there are like 50 houses. So instead of going through the code and doing house1, house2, house3… how do i do a loop for it? Here is the code for my collision detection:

[AS]
if (map1.house1.hitTestPoint(mainChar1.x, mainChar1.y, true))
{

            map1.y =  map1.y-speedy;
            map1.x =  map1.x-speedx;
            
            
        }[/AS]