I've figured out how to sort depths (added an Array for them) + set a variable on mouse click and stop rotating.
Here is my rotating menu for the archives (one thing I still don't like is that because the objects on the bottom are scaled down the angle between them seems too big) package { import flash.display.*; import flash.events.*; import flash.filters.*; public class RotMenu extends Sprite { public static const W:uint = 120; public static const H:uint = 80; public static const R:uint = 32; public static const BLUR:BlurFilter = new BlurFilter(2, 2, 1); private static const SHADOW:DropShadowFilter = new DropShadowFilter(8, 80, 0x000000, 0.4, 32, 32, 1, 1, false, false, false); private static var A:Number; private static var B:Number; private static const GR:Number = Math.PI / 180; private var start:Number = 0; private var delta:Number = 0; private var depths:Array; private static var mouseDown:Boolean; public function RotMenu(total:uint) { depths = new Array(total); delta = Math.min(60, 360 / total); for (var i:uint = 0; i < total; i++) { var rect:Sprite = new Sprite(); // do not show the rect before its coordinates // have been set by handleEnterFrame() rect.visible = false; rect.graphics.lineStyle(4, 0x4F69B5); rect.graphics.drawRoundRect(-W/2, -H/2, W, H, R); rect.graphics.lineStyle(2, 0x91BCE5); rect.graphics.beginFill(0xA3DD8E); rect.graphics.drawRoundRect(-W/2, -H/2, W, H, R); rect.graphics.endFill(); rect.tabIndex = i; addChild(rect); depths[i] = rect; } addEventListener(Event.ADDED_TO_STAGE, handleAdded); addEventListener(Event.ENTER_FRAME, handleEnterFrame); addEventListener(MouseEvent.MOUSE_DOWN, handleMouseDown); addEventListener(MouseEvent.MOUSE_UP, handleMouseUp); addEventListener(MouseEvent.MOUSE_OUT, handleMouseOut); } private function handleMouseDown(event:MouseEvent):void { mouseDown = true; } private function handleMouseUp(event:MouseEvent):void { mouseDown = false; } private function handleMouseOut(event:MouseEvent):void { mouseDown = false; } private function handleAdded(event:Event):void { A = Math.min(x, stage.stageWidth - x) - W/2; B = Math.min(y, stage.stageHeight - y) - H/2 - 8; } private function handleEnterFrame(event:Event):void { // the starting angle - for the 1st rect if (! mouseDown) start += mouseX / 100; for (var i:uint = 0; i < depths.length; i++) { var rect:Sprite = depths[i]; var angle:Number = start + delta * rect.tabIndex; // scale the rect from (0.70-0.30) to (0.70+0.30) rect.scaleX = rect.scaleY = 0.7 + 0.3 * Math.sin(angle * GR); rect.x = A * Math.cos(angle * GR); rect.y = -B * Math.sin(angle * GR); rect.filters = (rect.y > 16 ? [BLUR, SHADOW] : [SHADOW]); rect.visible = true; } depths.sortOn('y', Array.NUMERIC); for (var i:uint = 0; i < depths.length; i++) { var rect:Sprite = depths[i]; setChildIndex(rect, 0); } } } } And then in the .fla file: stop(); var rot:RotMenu = new RotMenu(12); rot.x = stage.stageWidth / 2; rot.y = stage.stageHeight / 3; addChild(rot); _______________________________________________ Flashcoders mailing list Flashcoders@chattyfig.figleaf.com http://chattyfig.figleaf.com/mailman/listinfo/flashcoders