jeudi 19 janvier 2017

Actionscript. Many buttons, controlling alpha onClick

Basically I'm creating like a odd version of BattleShip. So I have a Grid that will contain many, many buttons. I say buttons because thats what they currently are as opposed to movie clips or graphics unless the latter options are better.

What I want to do is that everytime I click one button I want the image to fade in. Showing weather the clicked button (say B3 on the grid) is a hit or miss.

Ive tried several ways to be able to click one, and move onto another. It has been a while since Ive used actionscript. So here is the current code im using that I found online for the one button i can get working

a1.addEventListener(MouseEvent.CLICK, fadeSquare);

function fadeSquare(event:MouseEvent):void 
    a1a.alpha = 1;

I need this to work with buttons called a1, a2, a3...ect Right now I have them as separate buttons and instances. Please help!

Aucun commentaire:

Enregistrer un commentaire