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.drawellipse(0,0,randomSize,randomSize);
- circle.x = randomSize/2;
- circle.y = randomSize/2;
- addChild(circle);
- }
- }
- }
Add Comment
Please, Sign In to add comment