Advertisement
Guest User

Untitled

a guest
Aug 21st, 2014
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import flash.events.MouseEvent;
  2.  
  3. var posx:Array = [330, 515, 700, 330, 515, 700, 330, 515, 700];
  4. var posy:Array = [50, 50, 50, 235, 235, 235, 420, 420, 420];
  5.  
  6. for(var i:int = 0; i < 9; i++){
  7. this["btn" + i].addEventListener(MouseEvent.ROLL_OVER, onOver);
  8. this["btn" + i].addEventListener(MouseEvent.ROLL_OUT, onOut);
  9. this["btn" + i].addEventListener(MouseEvent.CLICK, onClick);
  10. }
  11. function onOver(e:MouseEvent):void{
  12. var indice:String = ((e.currentTarget).name).slice(3,4);
  13. over.x = posx[indice];
  14. over.y = posy[indice];
  15. over.alpha = 0.6;
  16. }
  17. function onOut(e:MouseEvent):void{
  18. over.alpha = 0;
  19. }
  20. function onClick(e:MouseEvent):void{
  21. var indice:String = ((e.currentTarget).name).slice(3,4);
  22. clicked.x = posx[indice];
  23. clicked.y = posy[indice];
  24. clicked.alpha = 0.6;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement