Guest User

Untitled

a guest
Dec 13th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. package twl.core{
  2. import flash.display.*;
  3. import flash.events.*;
  4. public class Main extends Sprite {
  5. public function Main() {
  6. stage.addEventListener(MouseEvent.CLICK, clickListener);
  7. }
  8.  
  9. public function clickListener (e:MouseEvent):void {
  10. if (e.Target == stage) {
  11. drawCircle(e.StageX, e.StageY);
  12. } else {
  13. removeChild(DisplayObject(e.Target));
  14. }
  15. }
  16.  
  17. public function drawCircle (x:int, y:int):void {
  18. var randomColor:int = Math.floor(math.random()*0xFFFFFF);
  19. var randomSize:int = 10 + Math.floor(math.random()*50);
  20. var circle:Sprite = new Sprite();
  21. circle.graphics.beginfill(randomColor, 1);
  22. circle.graphics.linestyle();
  23. circle.graphics.drawellipse(0,0,randomSize,randomSize);
  24. circle.x = randomSize/2;
  25. circle.y = randomSize/2;
  26. addChild(circle);
  27. }
  28. }
  29. }
Add Comment
Please, Sign In to add comment