Positioning thumbnails in multiple containers

Hi I am making portfolio page and i would like to position my thumbnails in a grid like fasion in multiple
containers for thumbnails. I would like to have max 6 thumbnails in one container and when there are
6 thumbs in one i would like to create new container, move it to the right of the stage (so next 6 thumbs are not
visible). I got so far so i can position them in a grid but i do not know how to force them in new
container when they reach 6(max for one container). Can someone please point me in right direction?
My code so far(load complete for thumbs function):

function  thumbLoaded(event:Event):void
{

    thumbContentHolder = DisplayObject(thumbContentLoader.content)
    
    positionThumbs();

    
/// creating loop
    p ++;
    
    if(p < portfolioXML.item.length() )
     {
          loadThumbContent();
     }
         if(p == portfolioXML.item.length() )
     {
         p = 0
     }
}

function  positionThumbs():void
{
    this.addChild(thumbsHolder);
    thumbsHolder.y = thumbsHolderPosY;
    thumb = new Thumb();
    
    thumb.thumbBlack.addChild(thumbContentHolder);
    thumb.thumbZavihek.thumbAdress.text  = String(portfolioXML.item.title[p]);

    thumb.x = (thumb.width + paddingX) * posXCounter;
    thumb.y = (thumb.height + paddingY) * posYCounter;
    
    if(posXCounter +1 < colums)         
    {
        posXCounter ++;                            
    }
    else
    {
        posXCounter = 0;
         posYCounter ++;
    }
    thumbsHolder .addChild(thumb);
    thumbsHolder.x = stage.stageWidth /2 - thumbsHolder.width/2;
    
}

tnx
Luka