Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

enable and disable buttons

Status
Not open for further replies.

styleBunny

Technical User
Jun 20, 2002
133
AU
hi guys,

can i enable and disable all buttons with one line of code? or do i need to enable and disable each button with and instance name?

What i have is a range of buttons, which open different windows in my flash movie, with more info on it, i want to make it so none of the buttons in the background can be clicked until the back button on until the info window is closed.

This is all within a flash movie, when i say window i dont mean a browser window, it just runs a movie symbol on the stage.

Cheers
p.
 
You could do it with a bit more than one line of code:

Code:
function disableButtons(){
	butArray = new Array("but1","but2","but3","but4","but5");
	for(i=1;i<=butArray.length;i++){
		(_root[&quot;but&quot;+i].enabled)?(_root[&quot;but&quot;+i].enabled=0):(_root[&quot;but&quot;+i].enabled=1);
	}
}

Then just call the function from somewhere:

Code:
_root.disableButtons();

This will enable all your buttons that have their instance names in the array, if they are disabled. If they are enabled, it will disable them. frozenpeas
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top