Guest User

Untitled

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