In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

再帰

Get Adobe Flash player
by undo 28 Apr 2011
package {
    
    import flash.display.DisplayObject;
    import flash.display.DisplayObjectContainer;
    import flash.display.Graphics;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.KeyboardEvent;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    import flash.ui.Keyboard;

    [SWF(width='465', height='465', frameRate="30", backgroundColor='0x0')]
    public class ASTest extends Sprite{
        
        private var _childNum1:int = 4;
        private var _childNum2:int = 5;
        private var _color:uint = 0xaa4411;
        
        public function ASTest() {
            init();
        }
        private function init():void
        {
            var w:Circle = addChild(new Circle(stage.stageWidth/2, stage.stageWidth/2, stage.stageWidth/2, _color)) as Circle;
            w.addEventListener(Event.ENTER_FRAME, onEnter);
            
            makeChild(w, 1, stage.stageWidth/5, stage.stageWidth/2, _color);
        }
        
        private function makeChild(target:DisplayObjectContainer, index:int = 0, radius:Number = 100, bradius:Number = 100, color:uint = 0x0):void
        {
            var omega:Number = Math.PI * 2 / _childNum2;
            for(var i:int = 0; i < _childNum2; i++)
            {
                var p:Point = new Point(Math.cos(omega*i)*(bradius-radius),Math.sin(omega*i)*(bradius-radius));
                var c:Circle = target.addChild(new Circle(p.x,p.y,radius,color)) as Circle;
                if(index < _childNum1)
                {
                    makeChild(c,index+1,radius*2/5,radius,color);
                }
                c.addEventListener(Event.ENTER_FRAME, onEnter);
            }
        }
        
        private function onEnter(evt:Event):void
        {
            var target:DisplayObject = evt.target as DisplayObject;
            target.rotation += 0.2;
        }
    }
}
import flash.display.Sprite;
import flash.events.Event;

class Circle extends Sprite
{
    private var _color:uint;
    private var _radius:Number;
    public function Circle(x:Number = 0, y:Number = 0, radius:Number = 100, color:uint = 0xffffff)
    {
        _radius = radius;
        _color = color;
        this.x = x;
        this.y = y;
        
        init();
    }
    public function init():void
    {
        this.graphics.lineStyle(1,_color);
        this.graphics.drawCircle(0,0,_radius);
    }
}