PDA

View Full Version : removing and restoring with actionscript on button event.



xmattx
September 5th, 2003, 12:01 AM
this has to be simple

I have 3 movie clips. Each one is a button, on mouse over on each I want the button rolled over to make the other 2 invisable to the viewer, and then on mouse out i want them to be restored.

I have been trying to figure it out with no luck. Tried setting something up with 1=visable 2=non, and use these commands on mouse events... im getting stuck however. thank you for any help.

button instance names:
show
photo
book

thanks again.

claudio
September 5th, 2003, 12:09 AM
buttons_array = ["show", "photo", "book"];
function enableButton() {
this._visible = true;
for (var i in buttons_array) {
if (this._parent[buttons_array[i]]._name != this._name) {
this._parent[buttons_array[i]]._visible = false;
}
}
}
for (var j in buttons_array) {
this[buttons_array[j]].onRollOver = enableButton;
this[buttons_array[j]].onRollOut = function() {
for (var k in buttons_array) {
this._parent[buttons_array[k]]._visible = true;
}
};
}

xmattx
September 5th, 2003, 12:35 AM
thank you very much

claudio
September 5th, 2003, 12:38 AM
welcome ;)