AS3/ CS4 internal 3d carousel trouble

I have use one of Lee Brimelow's 3d carousel using the SimpleZSorter class.  Now the trouble I am having is:  How do I manipulate this code so that it only shows as the inner wall of the circle.  I only want to see the inside of the circle.  So the image in the center of the stage would be the furthest away.  As of right now the image in the center is the closest.  Can anyone help with this?

Thanks!
package {
	import com.gskinner.motion.GTween;
	import com.leebrimelow.utils.Math2;
	import com.theflashblog.fp10.SimpleZSorter;

	import fl.motion.easing.Exponential;

	import flash.display.Loader;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.net.URLLoader;
	import flash.net.URLRequest;

	public class Carousel extends Sprite {
		private var container:Sprite;
		private var loader:URLLoader;
		private var anglePer:Number;

		public function Carousel() {
			init();
			loadXML();
		}

		private function loadXML():void {
			loader=new URLLoader(new URLRequest("images.xml"));
			loader.addEventListener(Event.COMPLETE, createCarousel);
		}

		private function createCarousel(e:Event):void {
			var xml:XML=new XML(e.target.data);
			var list:XMLList=xml.image;
			anglePer = (Math.PI*2) / list.length();

			for (var i:int=0; i<list.length(); i++) {
				var imc:imCon = new imCon();
				imc.buttonMode=true;
				imc.addEventListener(MouseEvent.CLICK, onClick);

				var l:Loader = new Loader();
				l.x=-250;
				l.y=-167;
				l.load(new URLRequest(list[i].@src));
				imc.addChild(l);
				imc.scaleX=imc.scaleY=0.3;
				imc.angle = (i*anglePer) - Math.PI/2;
				imc.x=Math.cos(imc.angle)*250;
				imc.z=Math.sin(imc.angle)*250;
				imc.rotationY=36*- i;
				container.addChild(imc);
				//not working properly
				/*if (imc.z<=100) {
					imc.visible=false;
				}*/
			}
		}

		private function onClick(e:MouseEvent):void {
			var tw:GTween = new GTween(container, 0.8, {rotationY:Math2.toDeg(e.currentTarget.angle+Math.PI/2), z:100},
			{ease:Exponential.easeInOut});
			//tw.autoRotation = true;
		}

		private function init():void {
			container = new Sprite();
			container.x=470;
			container.y=150;
			container.z=-200;
			addChild(container);

			cover.addEventListener(MouseEvent.CLICK, stageClick);
			this.addEventListener(Event.ENTER_FRAME, loop);
		}

		private function stageClick(e:MouseEvent):void {
			var tw:GTween=new GTween(container,0.8,{z:400},{ease:Exponential.easeInOut});
		}

		private function loop(e:Event):void {
			container.rotationY=mouseX+250;
			//SimpleZSorter.sortClips(container);

		}
	}
}

Open in new window

cubical38Asked:
Who is Participating?
 
72lionsConnect With a Mentor Commented:
I'm sorry but the way I see it you will have to build it in another way. The whole concept is to add an ENTER_FRAME for each image, and in there you change the x, y, scaleX and scaleY properties.

Then you will have the ability to enter an if statement saying that if scaleX>1 then visible = false

Unfortunately I don't have something ready but I believe that this link has the most part ready: http://www.artluvr.com/2008/05/21/3d-carousel-xml-based-actionscript-3-flash-cs3/
0
 
cubical38Author Commented:
I think maybe I can build on this and get close to the effect I am looking for.  How would I go about the math as to say if my mouseX is on the right edge then the mc will be on the left and at a rotationY = -30 and vice versa for the other side?

Then I will need to add dynamically more sprites to the stage and find the effect I am looking for.

Any thoughts?

Thanks!
/*var gridBoxArray = new Array();

for (var i:Number = 0; i < 9; i++) {
	var picLoader:Sprite = new Sprite();
	addChild(picLoader);
	picLoader.graphics.beginFill(0xFF0000, 1);
	picLoader.graphics.drawRect(-180,0,180,150);
	picLoader.graphics.endFill();
	gridBoxArray.push(picLoader);
	picLoader.x = (i * 190) + picLoader.width;
	picLoader.y=50;
	//gridBoxArray[i].rotationY = (i * 10);

}*/
var picLoader:Shape = new Shape();
var center:Number = stage.stageWidth/2;
picLoader.graphics.beginFill(0xff9900);
picLoader.graphics.drawRect(-90,90,180,150);
picLoader.graphics.endFill();
addChild(picLoader);
stage.addEventListener("mouseMove",mouseMoveHandler);
function mouseMoveHandler(event:Event):void{
        picLoader.x = stage.stageWidth - stage.mouseX;
		picLoader.rotationY = center-stage.mouseX;
}

Open in new window

0
 
cubical38Author Commented:
started over with a new file and code
0
All Courses

From novice to tech pro — start learning today.