Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. package code
  2. {
  3. import flash.display.Sprite;
  4. import flash.display.MovieClip;
  5. import flash.events.Event;
  6. public class myClass extends Sprite //MovieClip
  7. {
  8. public function myClass()
  9. {
  10. this.addEventListener(Event.ENTER_FRAME,dichuyen);
  11. };
  12. private var tx = 10;
  13. private var ty=10;
  14. private function dichuyen(e:Event)
  15. {
  16. traibanh.x +=tx;
  17. if(traibanh.x > stage.stageWidth - traibanh.width
  18. || traibanh.x<0)
  19. tx = -tx;
  20. traibanh.y+=ty;
  21. if(traibanh.y > stage.stageHeight - traibanh.height
  22. || traibanh.y<0)
  23. ty=-ty;
  24. }
  25. };
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement