// Move your mouse left and right package { import flash.display.Sprite; import flash.events.Event; public class RecursiveSpiral extends Sprite { [SWF(width = 500, height = 500)] public function RecursiveSpiral() { ///////////////////////// scaleX = scaleY = 0.5; x = stage.stageWidth / 2; y = stage.stageHeight / 2; addEventListener(Event.ENTER_FRAME, onLoop); function onLoop(evt:Event):void { graphics.clear(); graphics.lineStyle(0,0); spiral(mouseX, 200); } function spiral(step:Number= 10, maxIter:Number=100, x:Number=0, y:Number=0, inc:Number = 1):void{ if (inc < maxIter){ var theta:Number = inc * step * Math.PI / 180; graphics.lineTo(x, y); spiral(step, maxIter, x + theta * Math.cos(theta), y + theta * Math.sin(theta), inc + 1); } } ///////////////////////// } } } As Quiz #13 solution