Need help with code to toggle button activity

Hi,

I have a set of 5 button that change their opacity when clicked to a lower opacity. What I need to add is the ability to “toggle” the button to go back and forth from 100% opacity to 20% or whatever and then back to 100%. I would also like to add the ability to fade the opacity instead of it changing all at once. Her is the code as I have it so far.



ClickMe.addEventListener(MouseEvent.CLICK,f);
ClickMe.buttonMode = true;
 function f(e:Event){

for(var i:uint=1;i<=5;i++){

this["B"+i].alpha  = .5; 

}

}