Advertisement
Guest User

Untitled

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