package { import flash.display.Sprite; import flash.utils.Timer; import flash.events.TimerEvent; import flash.geom.Vector3D; import flash.geom.Point; public class Carousel10 extends Sprite { public var items:Array = new Array(); public var timer:Timer; public var enc:Sprite; public function Carousel10() { timer = new Timer(30); timer.addEventListener(TimerEvent.TIMER, onTimer); draw(); timer.start(); } public function draw():void { enc = new Sprite(); enc.x = stage.stageWidth/2; enc.y = stage.stageHeight/2; addChild(enc); var thumb:Sprite; thumb = createThumb(); thumb.z = 200; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = -45; thumb.x = -140; thumb.z = 140; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = 90; thumb.x = -200; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = 45; thumb.x = -140; thumb.z = -140; enc.addChild(thumb); thumb = createThumb(); thumb.z = -200; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = -45; thumb.x = 140; thumb.z = -140; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = -90; thumb.x = 200; enc.addChild(thumb); thumb = createThumb(); thumb.rotationY = 45; thumb.x = 140; thumb.z = 140; enc.addChild(thumb); } private function createThumb():Sprite { var thumb:Sprite = new Sprite(); thumb = new Sprite(); thumb.graphics.lineStyle(1,0x0,1,true); thumb.graphics.beginFill(0xFF0000); thumb.graphics.drawRect(-64,-40,128,80); return thumb; } public function onTimer(event:TimerEvent):void { enc.rotationY+=3; var item:Sprite = enc.getChildAt(0) as Sprite; var p:Point = item.local3DToGlobal(new Vector3D(0,0,200)); var v:Vector3D = item.globalToLocal3D(new Point(100,0)); trace(v.x); } } }