Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.events.MouseEvent;
- var select:String;
- for(var i:int = 0; i < 9; i++){
- this["btn" + i].addEventListener(MouseEvent.ROLL_OVER, onOver);
- this["btn" + i].addEventListener(MouseEvent.ROLL_OUT, onOut);
- this["btn" + i].addEventListener(MouseEvent.CLICK, onClick);
- }
- function onOver(e:MouseEvent):void{
- var indice:String = ((e.currentTarget).name).slice(3,4);
- if (select != indice){
- over.x = this["btn" + indice].x - 100;
- over.y = this["btn" + indice].y - 100;
- over.alpha = 1;
- }
- }
- function onOut(e:MouseEvent):void{
- over.alpha = 0;
- }
- function onClick(e:MouseEvent):void{
- var indice:String = ((e.currentTarget).name).slice(3,4);
- clicked.x = this["btn" + indice].x - 100;
- clicked.y = this["btn" + indice].y - 100;
- over.alpha = 0;
- clicked.alpha = 1;
- select = indice;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement