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