Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import flash.events.MouseEvent;
- var posx:Array = [330, 515, 700, 330, 515, 700, 330, 515, 700];
- var posy:Array = [50, 50, 50, 235, 235, 235, 420, 420, 420];
- 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);
- over.x = posx[indice];
- over.y = posy[indice];
- over.alpha = 0.6;
- }
- function onOut(e:MouseEvent):void{
- over.alpha = 0;
- }
- function onClick(e:MouseEvent):void{
- var indice:String = ((e.currentTarget).name).slice(3,4);
- clicked.x = posx[indice];
- clicked.y = posy[indice];
- clicked.alpha = 0.6;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement