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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have other buttons disappear when over one

Status
Not open for further replies.

thecynicality

Technical User
Dec 29, 2004
48
0
0
US
Ok say i have 2 buttons on a page, is there an actionscript that will make 1 dissappear when i have the mouse over the other?
 
You're now saying only 2 buttons... Will it be 5 or more, once I go through making you an example .fla with only 2?

Regards. Affiliate Program - Web Hosting - Web Design
After 25,000 posts, banned on FK, but proud not to have bowed down to them!
 
Given that button1 and button2 have the same parent,
Code:
button2.onRollOver = function() {
     this._parent.button1._visible = false;
}
button2.onRollOut = function() {
     this._parent.button1._visible = true;
}
 
for all buttons.....assumes they are on the root but if not change root to the name of the clip they are in

Code:
Button.prototype.onRollOver = function(){
	for(var btn in _root){
	if(typeof(_root[btn])=="object" && _root[btn].type== undefined)
//to eliminate textfields 
	_root[btn]._visible = false;
	}
	_root[this._name]._visible = true;
}
Button.prototype.onRollOut = function(){
	for(var btn in _root){
	if(typeof(_root[btn])=="object" && _root[btn].type== undefined)
	_root[btn]._visible = true;
	}
}


only works with user defined buttons and not with the flash push button which is different
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top