Posted By

bradvanspriellgmailcom on 10/15/10


Tagged

event mouse and use actions


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

palo
sexyflash


Mouse Event


 / Published in: ActionScript 3
 

This shows Mouse Event code and an example of use

  1. //nextButton functionality;
  2. nextButton.buttonMode = true;
  3. nextButton.useHandCursor = true;
  4. nextButton.mouseChildren = false;
  5. nextButton.addEventListener(MouseEvent.MOUSE_DOWN,nextPhoto);
  6. nextButton.addEventListener(MouseEvent.MOUSE_OVER, nextTextVisible);
  7. nextButton.addEventListener(MouseEvent.MOUSE_OUT, nextTextInvisible);
  8.  
  9. //Tweener.addTween(nextButton, {_color:0x0000ff, time:.5, transition:"easeOutQuart";
  10. //Tweener.addTween(nextButton, {_color:null, time:1, transition:"easeOutQuart"
  11. function nextTextVisible(e:MouseEvent):void
  12. {
  13. Tweener.addTween(nextTextText, {alpha:1, time:.5, transition:"easeOutQuart"});
  14. }
  15. function nextTextInvisible(e:MouseEvent):void
  16. {
  17. Tweener.addTween(nextTextText, {alpha:0, time:.5, transition:"easeOutQuart"});
  18. }
  19.  
  20. function nextPhoto(e:MouseEvent)
  21. {
  22. if (photoCounter != totalPhotos)
  23. {
  24. trace(photoCounter);
  25. Tweener.addTween(this["photo"+photoCounter], {alpha:0, time:.5, transition:"easeOutQuad", onComplete:fadeInNext});
  26. photoCounter = photoCounter + 1;
  27. }
  28. else
  29. {
  30. Tweener.addTween(this["photo"+photoCounter], {alpha:0, time:.5, transition:"easeOutQuad", onComplete:fadeInNext});
  31. photoCounter = 1;
  32. }
  33. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: jirirybar on October 26, 2010

I always preffer to use MouseEvent.CLICK instead of MouseEvent.MOUSE_DOWN, just to bring the standard browser-like experience.

You need to login to post a comment.