Posted By

dandyna on 07/24/06


Tagged

actionscript flash


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

dandyna


Delayed duplicated mouse followers


 / Published in: ActionScript
 

URL: http://dandyland.org/?page_id=32

movie clip che seguono il percorso del mouse, ma non sono attaccate ad esso

  1. /*on the first frame of the main scene:*/
  2. i=0; /*copie nella scena*/
  3.  
  4. /*on the movie clip you want to animate:*/
  5. onClipEvent (load) {
  6. _x = 0;
  7. _y = 0;
  8. v = random(10)+10;
  9. }
  10. onClipEvent (enterFrame) {
  11. finex = _root._xmouse;
  12. finey = _root._ymouse;
  13. _x += (finex-_x)/v;
  14. _y += (finey-_y)/v;
  15. }
  16.  
  17. /*or the following, it's your choice.*/
  18.  
  19. onClipEvent (load) {
  20. dx=0;
  21. dy=0;
  22. v=random(10)+10;
  23. _x=(random(8)+1)/10*_root.width;
  24. _y=(random(8)+1)/10*_root.height;}
  25.  
  26. onClipEvent(enterframe) {
  27. dx=(_root._xmouse-_x)/v;
  28. dy=(_root._ymouse-_y)/v;
  29. _x+=dx;
  30. _y+=dy;
  31. }
  32.  
  33.  
  34. /*then, on an invisible movieclip somewhere in the stage:*/
  35. onClipEvent (load) {
  36. for (i=1; i<10; i++) {
  37. duplicateMovieClip("_root.freccia", "_root.freccia"+i, i+100);
  38. c = eval("_root.freccia"+i);
  39. c._x = random(550);
  40. c._y = random(400);
  41.  
  42. }
  43. }

Report this snippet  

You need to login to post a comment.