[RESOLVED] buttons to stay in down state after clicked
I am trying to get buttons to stay in the down state after it is clicked and remain there. I want the user to know what buttons they have clicked. I am using flash 8. Here is code:
my1_btn.onPress = function () {
gotoAndStop("down");
};
my2_btn.onPress = function () {
gotoAndStop("down");
};
my3_btn.onPress = function () {
gotoAndStop("down");
};
my4_btn.onPress = function () {
gotoAndStop("down");
};
my5_btn.onPress = function () {
gotoAndStop("down");
};
the down state works when pressed but doesn't stay.
gotoAndStop is not a method of the button class. try making your buttons into movie clips, control the rollOver/Out and press/release functionality with AS just like you're doing above, and either label frames in the mcs or just use frames one two and three (maybe four). You'll then have to break the onRollOut function (which resets the mc too the original state) as part of your onRelease function.
clipArray = [clip0,clip1,clip2]; // array holds the clip instance names
function downState(mc){
for(var n=0;n!=clipArray.length;n++){
clipArray[n].gotoAndStop("_up"); // send all to up-state
clipArray[n].enabled = true; // make all enabled
}
mc.gotoAndStop("_down"); // send pressed clip to down-state
mc.enabled = false; // make pressed clip disabled
};
// each clip sends its instance name to the function
clip0.onRelease = function(){ downState(this); };
clip1.onRelease = function(){ downState(this); };
clip2.onRelease = function(){ downState(this); };
a_modified_dog that works great but when I click the button to send it to another frame with the button still on frame it returns to up state and is inactive i want it to stay in down state throughout timeline
i want once they are clicked whether any other button is clicked to stay in down state so in your example if you go from frame 1-2-3-4 at frame 4 all buttons would be red because they all have been clicked I have it set up now like your