RandomCircles

by O_MEG_A
♥0 | Line 23 | Modified 2015-05-14 07:24:51 | MIT License
play

ActionScript3 source code

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

package {

        import flash.display.Sprite;

        import flash.events.MouseEvent;

        public class Draw_Circles extends Sprite {

        public function Draw_Circles():void {

         stage.addEventListener(MouseEvent.CLICK, SpareCircle);

        }

        private function SpareCircle(event:MouseEvent):void {

            var Radius:int = 5;

            Radius = Radius + (Math.random()*5);

            var Circle:Sprite = new Sprite();

            Circle.scaleX = Circle.scaleY = 0;

            Circle.graphics.beginFill(Math.random() * 0xFF00000);

            Circle.graphics.drawCircle(0,0, Radius);

            Circle.alpha = Math.random() * 100;

            Circle.graphics.endFill();

            addChild(Circle);
          
            Circle.x=event.stageX;

            Circle.y=event.stageY;
         
            Circle.scaleX = Circle.scaleY = 5;
       
        }

    }
}