Two sets of sticky buttons

hi,
sorry for being such a greenhorn, but i have the following problem:

i have a console wherein i can load movies and sounds. there are 3 movie-buttons and 3 sound-buttons. (you can combine every sound with every movie)
is there a possibility to makee the buttons “sticky” to see which buttons are pushed?

thanks a lot
jsn

Ahh… you wanna make it where the buttons stay pressed down as soon as you push it… But if they push it again to push it back up?

Place the following code in the frame that the buttons reside in…

[AS]
_root.onLoad = function()
{
but1OnOff = FALSE;
but2OnOff = FALSE;
but3OnOff = FALSE;
}

but1.onPress = function()
{
if(but1OnOff == FALSE)
{
but1OnOff = TRUE;
this.gotoAndStop(2);
} else {
but1OnOff = FALSE;
this.gotoAndStop(1);
}
}
but2.onPress = function()
{
if(but2OnOff == FALSE)
{
but2OnOff = TRUE;
this.gotoAndStop(2);
} else {
but2OnOff = FALSE;
this.gotoAndStop(1);
}
}
but3.onPress = function()
{
if(but3OnOff == FALSE)
{
but3OnOff = TRUE;
this.gotoAndStop(2);
} else {
but3OnOff = FALSE;
this.gotoAndStop(1);
}
}
[/AS]

Now… Each of your buttons movieclips should contain 2 frames… The first frame is the button when it’s not clicked in… The second one is when it is clicked in… You should have a stop(); AS code in each of these frames.

Hope this helped you out. :slight_smile: Have fun posting around.

thanx,
i will try it…
jns

Yeah… Gimme some feedback if it worked out for you or not… If it didn’t… I’ll see what I can do for you :beam::player:

hi playamarz,
thanks a lot for for your hints.
your script works perfect, but i think i made a wrong description:

if there is one button pressed and another button is getting pressed, the first one should pop up again to default position.

but thanks i think i will find a way starting with your script to solve this little problem…

if i get stuck somewhere i will ask again

=) :slight_smile:

i get stucked…

i worked a little on this matter, but i still wonder how i will get a kind of mouseover?

this is what i done… mayby there could be some improvements in this case…

_root.onLoad = function() {
but1OnOff = false;
but2OnOff = false;
but3OnOff = false;
};
but1.onPress = function() {
if (but1OnOff == false) {
but1OnOff = true;
but2OnOff = false;
but3OnOff = false;
but1.gotoAndStop(2);
but2.gotoAndStop(1);
but3.gotoAndStop(1);
film.stop();
film.loadMovie(“001.swf”);
} else {
but1OnOff = false;
but1.gotoAndStop(1);
}
};
but2.onPress = function() {
if (but2OnOff == false) {
but2OnOff = true;
but1OnOff = false;
but3OnOff = false;
but2.gotoAndStop(2);
but1.gotoAndStop(1);
but3.gotoAndStop(1);
film.stop();
film.loadMovie(“002.swf”);
} else {
but2OnOff = false;
but2.gotoAndStop(1);
}
};
but3.onPress = function() {
if (but3OnOff == false) {
but3OnOff = true;
but1OnOff = false;
but2OnOff = false;
but3.gotoAndStop(2);
but1.gotoAndStop(1);
but2.gotoAndStop(1);
film.stop();
film.loadMovie(“002.swf”);
} else {
but3OnOff = false;
but3.gotoAndStop(1);
}
};

:q:

hi playamarz,
just to keep you on track: this is what i make of your script-hint:

now i have some mouseover-effect also…

_root.onLoad = function() {
but1OnOff = false;
but2OnOff = false;
but3OnOff = false;
};
but1.onRollOver = function() {
if (but1OnOff == false) {
but1.gotoAndStop(2);
} else {
but1OnOff = true;
but1.gotoAndStop(2);
}
};
but1.onRollOut = function() {
if (but1OnOff == true) {
but1.stop();
} else {
but1OnOff = false;
but1.gotoAndStop(1);
}
};
but1.onPress = function() {
if (but1OnOff == false) {
but1OnOff = true;
but2OnOff = false;
but3OnOff = false;
but1.gotoAndStop(2);
but2.gotoAndStop(1);
but3.gotoAndStop(1);
film.stop();
film.loadMovie(“001.swf”);
} else {
if (but1OnOff == true) {
but1OnOff = true;
} else {
but1OnOff = false;
but1.gotoAndStop(1);
}
}
};

and so on …

maybe you have some improvements…

thanks again