Posted By

dandyna on 09/12/06


Tagged

actionscript mouse move rotation


Versions (?)

Who likes this?

6 people have marked this snippet as a favorite

Roshambo
damarev
dandyna
jitendramr
visualAesthetic
vali29


Rotate items while mouse moving


 / Published in: ActionScript
 

Useful for product showcases

  1. //sulla clip filmato che contiene i 60 fotogrammi,fare in modo che quando facciamo click col mouse, l'omino faccia uno scatto di sei gradi, cioè prosegua di un fotogramma
  2.  
  3. onClipEvent (load) {
  4. stop();
  5. }
  6. onClipEvent (mouseDown) {
  7. if (_currentframe == _totalframes) {
  8. gotoAndStop(1);
  9. } else {
  10. nextFrame();
  11. }
  12. }
  13.  
  14.  
  15. //fare in modo che quando il mouse si muove l'omino si giri in quella direzione
  16.  
  17. onClipEvent (mouseMove) {
  18. xmouse = _root._xmouse;
  19. if (xmouse>=_width*0.6) {
  20. dv = 1;
  21. } else if (xmouse<=_width*0, 4) {
  22. dv = -1;
  23. } else {
  24. dv = 0;
  25. }
  26. }
  27. onClipEvent (enterFrame) {
  28. frame_finale = _currentframe+dv;
  29. if (frame_finale<1) {
  30. frame_finale = _totalframes;
  31. } else if (frame_finale>_totalframes) {
  32. frame_finale = 1;
  33. }
  34. gotoAndStop(frame_finale);
  35. }

Report this snippet  

You need to login to post a comment.