# Two sets of sticky buttons

**URL:** <https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233>\
**Category:** Uncategorized\
**Created:** [March 22, 2003, 3:45pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233 "2003-03-22T15:45:43Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![jns](https://avatars.discourse-cdn.com/v4/letter/j/a6a055/32.png) [@jns](https://forum.kirupa.com/u/jns)\
**Post date:** [March 22, 2003, 3:45pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/1 "2003-03-22T15:45:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 22, 2003, 4:43pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/2 "2003-03-22T16:43:27Z")

</div>

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. 🙂 Have fun posting around.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 22, 2003, 5:38pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/3 "2003-03-22T17:38:43Z")

</div>

thanx,  
i will try it…  
jns

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 12:48am UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/4 "2003-03-23T00:48:51Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 23, 2003, 7:08pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/5 "2003-03-23T19:08:28Z")

</div>

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

=) 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 24, 2003, 12:11am UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/6 "2003-03-24T00:11:47Z")

</div>

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:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [March 24, 2003, 6:31pm UTC](https://forum.kirupa.com/t/two-sets-of-sticky-buttons/16233/7 "2003-03-24T18:31:02Z")

</div>

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
