hi,
i am trying to make a prototype function that allows buttons to act like they would in html. What i mean by that is that when you rollover button1, it changes from colour A to colour B. On rollout, it goes back to colour A.
However if you click the button, then it goes to colour C. Even when you rollout, i want the button to stay as colour C.
when you rollover button2, the same thing happens but button1 doesn’t return to colour A until button2 is pressed.
so i’m trying to emulate the “down state” and “hover state” that you would have in html links.
the code i am working on is like this:
var topNavArray = ["homeButt1", "homeButt2", "homeButt3", "homeButt4", "homeButt5", "homeButt6", "homeButt7", "close"];
//create the prototype call changeColors
MovieClip.prototype.topNavColors = function() {
//create for loop to go through the buttonArray list
for (var i = 0; i<topNavArray.length; i++) {
//create color object that targets each clip in the array
var myColor = new Color(this._parent[topNavArray*]);
//if the instance name in the current position in the array is not equal to this clips name
if (topNavArray* != this._name) {
//set the RGB value to 0x000000 (black)
myColor.setRGB(0xffffff);
} else {
//else if it is the same as ths clips name
//set the RGB to 0xFF0000 (red)
myColor.setRGB(0xd0cbc0);
}
}
};
MovieClip.prototype.navRollOut = function() {
//create for loop to go through the buttonArray list
for (var i = 0; i<topNavArray.length; i++) {
//create color object that targets each clip in the array
var myColor = new Color(this._parent[topNavArray*]);
//if the instance name in the current position in the array is not equal to this clips name
//else if it is the same as ths clips name
//set the RGB to 0xFF0000 (red)
myColor.setRGB(0xffffff);
}
};
and i just call it with:
button1.onRollOver = function(){
this.topNavColors();
}
button1.onRollOut = function(){
this.navRollOut();
}
the problem i face whatever i do is that any coding i do for the button on press, it gets cancelled out again the second i roll off that button.
get it?
i’ve tried loads of variations on this (including containing everything in 1 function and setting variables for the different colours), but i just can’t figure it out!!!
any help, advice, code is appreciated.
thanks,
kd