Guest User

Untitled

a guest
Oct 31st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.display.Sprite;
  2. import fl.transitions.Tween;
  3. import fl.transitions.easing.*;
  4.  
  5. var box:Sprite = new Sprite();
  6.     box.graphics.beginFill(0xABCDEF);
  7.     box.graphics.drawCircle(0, 0, 10);
  8.     box.graphics.endFill();
  9.     this.addChild(box);
  10.    
  11. var tweenX:Tween;
  12. var tweenY:Tween;
  13.  
  14.  
  15. function moveBox(){
  16.     tweenX = new Tween(box, "x", Strong.easeOut, box.x, getRand(0, stage.stageWidth), 3, true);
  17.     tweenY = new Tween(box, "y", Strong.easeOut, box.y, getRand(0, stage.stageHeight), 3, true);
  18. }
  19.  
  20. function getRand(min:Number, max:Number){
  21.     return Math.round(Math.random()*(max-min))+min;
  22. }
  23.  
  24. var timer:Number = setInterval(moveBox, 2500);
Add Comment
Please, Sign In to add comment