Advertisement
Guest User

button fades AS3

a guest
Mar 26th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import fl.transitions.Tween;
  2. import fl.transitions.easing.*;
  3. // Dont duplicate the things above
  4.  
  5.  
  6. // Start value for the button. buttonOne is the instance name of the button. Alpha is between 0 and 1 so 50% is 0.5
  7. buttonOne.alpha = 0;
  8. buttonOne.addEventListener(MouseEvent.MOUSE_OVER, fadingInButtonOne);
  9. buttonOne.addEventListener(MouseEvent.MOUSE_OUT, fadingOutButtonOne);
  10.  
  11. //buttonTwo.alpha = 0;
  12. //buttonTwo.addEventListener(MouseEvent.MOUSE_OVER, fadingInButtonOne);
  13. //buttonTwo.addEventListener(MouseEvent.MOUSE_OUT, fadingOutButtonOne);
  14.  
  15.  
  16. //Read about the Tween class here if you want. There is alot that can be changed to the fade
  17. // http://www.republicofcode.com/tutorials/flash/as3tweenclass/
  18.  
  19.  
  20. function fadingInButtonOne(event: MouseEvent): void {
  21.     var myTween = new Tween(buttonOne, "alpha", Regular.easeIn, 0, 1, 15, false);
  22.     stop();
  23. }
  24. function fadingOutButtonOne(event: MouseEvent): void {
  25.      var myTween = new Tween(buttonOne, "alpha", Regular.easeIn, 1, 0, 15, false);
  26. }
  27.  
  28. //function fadingInButtonOne(event: MouseEvent): void {
  29. //  var myTween = new Tween(buttonOne, "alpha", Regular.easeIn, 0, 1, 15, false);
  30. //  stop();
  31. //}
  32. //function fadingOutButtonOne(event: MouseEvent): void {
  33. //   var myTween = new Tween(buttonOne, "alpha", Regular.easeIn, 1, 0, 15, false);
  34. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement