Vangar

Simple button using eventListener and a MovieClip class

Dec 3rd, 2011
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import flash.display.Stage;
  2. import flash.display.DisplayObject;
  3. import flash.display.MovieClip;
  4. import flash.events.MouseEvent;
  5.  
  6. var btn1:MovieClip = new newbutton();
  7. var rotationz:Number = 0.5;
  8.  
  9. btn1.x = 300;
  10. btn1.y = 250;
  11.  
  12.  
  13.  
  14. stage.addChild(btn1);
  15.  
  16. btn1.addEventListener(MouseEvent.MOUSE_DOWN, rotationness);
  17. btn1.addEventListener(MouseEvent.MOUSE_UP, rotationness);
  18.  
  19. function rotationness(e:MouseEvent) {
  20.    
  21.  
  22.    
  23.     btn1.alpha = rotationz;
  24.     rotationz += 0.1;
  25.     if (rotationz >= 1) {
  26.         rotationz = 1;
  27.     }
  28.     else if (rotationz < 0) {
  29.         rotationz = 0;
  30.     }
  31. }
  32.  
  33.  
  34. //btn1.addEventListener(MouseEvent.click);
  35.  
  36.  
Add Comment
Please, Sign In to add comment