# Positioning thumbnails in multiple containers

**URL:** <https://forum.kirupa.com/t/positioning-thumbnails-in-multiple-containers/289980>\
**Category:** flash\
**Created:** [June 8, 2009, 10:03am UTC](https://forum.kirupa.com/t/positioning-thumbnails-in-multiple-containers/289980 "2009-06-08T10:03:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![luka66\_6](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@luka66\_6](https://forum.kirupa.com/u/luka66_6)\
**Post date:** [June 8, 2009, 10:03am UTC](https://forum.kirupa.com/t/positioning-thumbnails-in-multiple-containers/289980/1 "2009-06-08T10:03:28Z")

</div>

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):

```auto
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
