Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package twl.core
- {
- import flash.display.*;
- import flash.events.*;
- public class Main extends Sprite
- {
- public function Main()
- {
- stage.addEventListener(MouseEvent.CLICK, clickListener);
- }
- public function clickListener(e:MouseEvent):void
- {
- if (e.target == stage)
- {
- drawCircle(e.stageX, e.stageY);
- }
- else
- {
- removeChild(DisplayObject(e.Target));
- }
- }
- public function drawCircle(x:int, y:int):void
- {
- var randomColor:int = Math.floor(Math.random()*0xFFFFFF);
- var randomSize:int = 10 + Math.floor(Math.random()*50);
- var circle:Sprite = new Sprite();
- circle.graphics.beginFill(randomColor, 1);
- circle.graphics.lineStyle();
- circle.graphics.draweElipse(0,0,randomSize,randomSize);
- circle.x = randomSize/2;
- circle.y = randomSize/2;
- addChild(circle);
- }
- }
- }
Add Comment
Please, Sign In to add comment