Need help with 3D carousel gallery rotation to a specific angle
Hi,
I am making a 3d gallery, that has a menu underneath it. When clicking to a menu link, the gallery will rotate itself to a certain angle (photo) connected with the menu link. I am using FlashAndMaths 3D cylindrical gallery scripts (XML Customizable 3D Cylindrical Photo Gallery in Flash) as the base (as I couldn't find any free or neither payed 3d galleries that would have a menu connected to the carousel!).
The function to rotate a carousel of thumbnails is the following:
public function doRotate(ang:Number):void {
if(isLoading || notReady){
return;
}
if(!this.contains(container)){
return;
}
var i:int;
for(i=0;i<numCols;i++){
colsVec.rotationY+=ang;
colsVec.rotationY=colsVec.rotationY%360;
if((colsVec.rotationY>90+diffAng && colsVec.rotationY<270-diffAng) || (colsVec.rotationY<-(90+diffAng) && colsVec.rotationY>-(270-diffAng))){
if(container.contains(colsVec)){
container.removeChild(colsVec);
}
} else {
if(!container.contains(colsVec)){
container.addChild(colsVec);
}
}
}
}
This will rotate the carousel as an infinite loop. However - I need the function to stop at a certain angle e.g. 45% (and/or reset itself to 0%). Another option would be to stop the carousel at a certain thumbnail container.
The function to create a carousel is here:
thumbWidth=thumbsArray[0][0].width;
thumbHeight=thumbsArray[0][0].height;
colsVec=new Vector.<Column>();
colHeight=thumbHeight*colLen+(colLen-1)*pxSpace;
colWidth=thumbWidth;
rad=galLoader.radius;
angle=360/numCols;
container=new Sprite();
this.addChild(container);
containerWidth=2*rad;
vertAddOn=40;
vertDrop=15;
containerHeight=colHeight+vertAddOn;
container.x=containerWidth/2;
container.y=containerHeight/2+vertDrop;
contMask=new Shape();
this.addChild(contMask);
contMask.x=container.x;
contMask.y=container.y;
prepContainer();
diffAng=Math.round((Math.asin(rad/fL)*180/Math.PI)*1000)/1000;
for(i=0;i<numCols;i++){
colsVec= new Column(thumbsArray,pxSpace,rad);
container.addChild(colsVec);
colsVec.y=0;
colsVec.x=0;
colsVec.z=0;
colsVec.rotationY=angle*i;
if((colsVec.rotationY>90+diffAng && colsVec.rotationY<270-diffAng) || (colsVec.rotationY<-(90+diffAng) && colsVec.rotationY>-(270-diffAng))){
if(container.contains(colsVec)){
container.removeChild(colsVec);
}
} else {
if(!container.contains(colsVec)){
container.addChild(colsVec);
} } }
Could anyone help me as I'm out of ideas!
