# Dynamic size carousel

**URL:** <https://forum.kirupa.com/t/dynamic-size-carousel/285142>\
**Category:** flash\
**Created:** [March 27, 2009, 2:57pm UTC](https://forum.kirupa.com/t/dynamic-size-carousel/285142 "2009-03-27T14:57:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pezfish](https://avatars.discourse-cdn.com/v4/letter/p/f19dbf/32.png) [@Pezfish](https://forum.kirupa.com/u/Pezfish)\
**Post date:** [March 27, 2009, 2:57pm UTC](https://forum.kirupa.com/t/dynamic-size-carousel/285142/1 "2009-03-27T14:57:50Z")

</div>

I’m setting up a vertical carousel in and am having a problem getting the images to be the right size with a variable amount of items. If I wanted all of the images to be a set size of 200 x 200 when they are front facing what would I need to do?

Here’s the code I’m using:

```auto

import gs.TweenLite;
import com.theflashblog.fp10.SimpleZSorter;

var total:uint = 10;
var anglePer:Number = (Math.PI*2) / total;
var circleSize:Number = 40*total;
var j:uint = 1;
var totalDivide:int = 360/total;

for(var i:uint = 0; i<total; i++){
    var clip:Block = new Block();
    clip.angle = (i*anglePer) - Math.PI/2;
    clip.z = Math.cos(clip.angle)*circleSize;
    clip.y = Math.sin(clip.angle)*circleSize;
    clip.rotationX = -90;
    contentLoader_mc.addChild(clip);
}

contentLoader_mc.z = 1000;
contentLoader_mc.rotationX = 90;
btn_mc.addEventListener(MouseEvent.CLICK, onClick);
SimpleZSorter.sortClips(contentLoader_mc);

function onClick(event:MouseEvent){
    var plusRotate:Number = (totalDivide*j)+90;
    var minusRotate:Number = -((totalDivide*j)+90);
    TweenLite.to(contentLoader_mc, .5, {rotationX:plusRotate});
    for (var i:uint = 0; i < contentLoader_mc.numChildren; i++){
        var currentClip:DisplayObject = contentLoader_mc.getChildAt(i);
        TweenLite.to(currentClip, .5, {rotationX:minusRotate});
    }
    SimpleZSorter.sortClips(contentLoader_mc);
    (j<total-1)?(j++):(j=0);
};

```

I’m assuming it has something to do with the circleSize variable and contentLoader\_mc.z I’m setting but I can’t figure out the math involved. Anyone have any advice or a direction of where to point me?

Thanks
