Disabling buttons in actionscript 3

I have an array of buttons. I need to be able to disable/change appearance of the selected button.

I´ve attached  the main code but can send you the .fla directly if you give me an email address....

Any help much appreciated.... solving this is worth 1000 points easily!
import fl.transitions.Tween;
import fl.transitions.easing.*;
 
var nextSection:String = "";
 
function createAndyMenu(btns:Array):void {
	for (var i:Number = 0; i<btns.length; i++) {
		var btn:MovieClip = new AndyMc();
		btn.x = 0 - i*25;
		var btnCurrentPos = btn.x;
		btn.y = 18 + (btn.height * i);
		btn.name = btns[i];
		btn.menuTxtMc._label.text = btn.name;
		btn.menuTxtMc._label.mouseEnabled = false;
		btn.mouseChildren = false;
		btn.buttonMode = true;
		btn.useHandCursor = true;
		if (btn.x < 50) {
			var btnXTween:Tween = new Tween(btn, "x", Strong.easeOut, btnCurrentPos, 18, 1, true);
			var btnAlphaTween:Tween = new Tween(btn, "alpha", Strong.easeOut, 0, 1, 1, true);
		}
 
		btn.addEventListener(MouseEvent.CLICK, navigate, false, 0, true);
		btn.addEventListener(MouseEvent.MOUSE_OVER, overBtn, false, 0, true);
		btn.addEventListener(MouseEvent.MOUSE_OUT, outBtn, false, 0, true);
		btn.addEventListener(MouseEvent.CLICK, clickBtn, false, 0, true);
		addChild(btn);
		//var blankBtn:String = btns[6];
		
	} // closes for loop!!
	
}
 
createAndyMenu(["QUIÉNES SOMOS","NUESTROS ACCIONISTAS","CRITERIOS DE INVERSIÓN",
				"FORMAS DE PARTICIPACIÓN","EMPRESAS PARTICIPADAS", "POR QUÉ EXTREMADURA"]);
 
 
//define the function each button will call
function navigate(evt:MouseEvent):void {
	//the destination frame label is derived from the name of the button clicked
	nextSection = evt.target.name;
	
	play();
}
 
function overBtn(event:MouseEvent):void{
	trace("over");
	//trace(btn.name);
	event.target.gotoAndPlay("over");
}
 
function outBtn(event:MouseEvent):void{
	trace("out");
	//trace(btn.name);
	event.target.gotoAndPlay("out2");
}
 
function clickBtn(event:MouseEvent):void{
	trace("click");
	//trace(btn.name);
	event.target.gotoAndStop("clicked");
	
}

Open in new window

andy_74mAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

scooby_56Commented:
you can post the .fla here. Just add .txt to the end of the name
0
andy_74mAuthor Commented:
OK, here you go
thanks
buttons-set.txt
0
scooby_56Commented:
I'd do it like this...

create an array to store you buttons. When creating the insances of the buttons, push each button into this array.

Within the click event function (clickBtn), remove the onclick Event listner for that button - just after looping round all button in your array and adding the click listner.

e.g.
addClickLisners()  //just create a function which iterates through the buttons and adds the click listners.
event.target.removeLisntner(MouseEvent.CLICK, onClick);

Also you could change the alpha property to say .5 for the event.target also


If you need help with the code, i'll  have more time to look tomorrow.
0
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

andy_74mAuthor Commented:
OK - not sure exactly how I would do that so would appreciate more specific help tomorrow...

I already managed to change the alpha property of the selected button - I just couldn´t change it back when the next button was selected - I think I need some kind of 'selected' variable or something - just not sure how to get it working...

(btw I would like the selected state of the button to be black text)
0
scooby_56Commented:
as described above.
buttons-set2.fla.txt
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
andy_74mAuthor Commented:
you´re a star... thanks very much
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Adobe Flash

From novice to tech pro — start learning today.