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[i].rotationY+=ang; colsVec[i].rotationY=colsVec[i].rotationY%360; if((colsVec[i].rotationY>90+diffAng && colsVec[i].rotationY<270-diffAng) || (colsVec[i].rotationY<-(90+diffAng) && colsVec[i].rotationY>-(270-diffAng))){ if(container.contains(colsVec[i])){ container.removeChild(colsVec[i]); } } else { if(!container.contains(colsVec[i])){ container.addChild(colsVec[i]); } } } }
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[i]= new Column(thumbsArray[i],pxSpace,rad); container.addChild(colsVec[i]); colsVec[i].y=0; colsVec[i].x=0; colsVec[i].z=0; colsVec[i].rotationY=angle*i; if((colsVec[i].rotationY>90+diffAng && colsVec[i].rotationY<270-diffAng) || (colsVec[i].rotationY<-(90+diffAng) && colsVec[i].rotationY>-(270-diffAng))){ if(container.contains(colsVec[i])){ container.removeChild(colsVec[i]); } } else { if(!container.contains(colsVec[i])){ container.addChild(colsVec[i]); } } }
Could anyone help me as I'm out of ideas!