Event listeners not firing consistently

Hi,

Pretty much a complete n00b at flash and am stuck. Hoping someone will take pity :violin:

I have 9 buttons on my site which I wish to increase to 100% alpha when the users mouse rolls over each one, then have the alpha reduced to the original setting of 75% on rollout.

If I set the code below for 1 button it works just fine. However, if I repeat this code just changing the numbers for each button, it stops working once duplicated more than a couple of times.

Why does it stop working and how can I write this efficiently so it works for all 9 buttons?

Here is the code:-

addtocart1_btn.addEventListener(MouseEvent.MOUSE_OVER, fadeinaddtocart1);

function fadeinaddtocart1(event:Event):void
{
addtocart1_btn.alpha = 1;
}

addtocart1_btn.addEventListener(MouseEvent.MOUSE_OUT, fadeoutaddtocart1);

function fadeoutaddtocart1(event:Event):void
{
addtocart1_btn.alpha = 0.75;
}

addtocart2_btn.addEventListener(MouseEvent.MOUSE_OVER, fadeinaddtocart2);

function fadeinaddtocart2(event:Event):void
{
addtocart2_btn.alpha = 1;
}

addtocart2_btn.addEventListener(MouseEvent.MOUSE_OUT, fadeoutaddtocart2);

function fadeoutaddtocart2(event:Event):void
{
addtocart2_btn.alpha = 0.75;

thanks :slight_smile: