[ff]: addChild( rotation )

by bradsedito forked from addChild...(rotation) on 2012-8-26 (diff: 21)
♥1 | Line 49 | Modified 2012-08-27 05:18:21 | MIT License
play

ActionScript3 source code

/**
 * Copyright bradsedito ( http://wonderfl.net/user/bradsedito )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/g0hI
 */




package
{
    import flash.display.*
    import flash.events.*
    import flash.geom.*
    import flash.ui.*
    
    [SWF(width="600",height="600",backgroundColor="0x000000",frameRate="60")]
    
    
    public class Main extends Sprite
    {
        public const SW:Number = stage.stageWidth
        public const SH:Number = stage.stageHeight
        
        
        public function Main()
        {
            var circleSize:Number = 60; 
            var s:Circle = new Circle(Math.random()*0xFFFFFF,circleSize);
            
            s.x = SW/2   
            s.y = SH/2            
            addChild(s);
            
            for (var i:int = 0; i<6; i++) 
            { 
                var sc:Circle  = new Circle(Math.random()*0xFFFFFF,circleSize);
                sc.x = circleSize*1.5;//*0.6;//*2.0;
                s.addChild(sc);
                s = sc;
            }
        }
    }
}

import flash.display.Sprite;
import flash.events.Event;
import flash.events.MouseEvent;
import flash.ui.Mouse;

class Circle extends Sprite
{
    private var angle:Number = 0;
    
    public function Circle(_color:uint,_radius:Number)
    {
        graphics.beginFill(_color,1.0);
        //graphics.lineStyle(0.0,0x000000,0.8,true);
        graphics.drawCircle(0,0,_radius);
        graphics.endFill();
        //blendMode = "overlay";
        blendMode = "add";
        addEventListener(Event.ENTER_FRAME,Move);
    }
    
    private function Move(e:Event):void
    {
        rotation = angle;
        angle++;
    }
}