# Problems with buttons bookmark...!

**URL:** <https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710>\
**Category:** flash\
**Created:** [April 20, 2003, 12:10am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710 "2003-04-20T00:10:11Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![filete](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/filete/32/124_2.png) [@filete](https://forum.kirupa.com/u/filete)\
**Post date:** [April 20, 2003, 12:10am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/1 "2003-04-20T00:10:11Z")

</div>

Hello there,

I have a slide show with 5 pictures, at the bottom i have put  
5 simple white square buttons.  
I want to make the square white button change to red when i click  
on them, and a new picture appears.  
The problem is that i don´t understand how can i make the buttons stay  
red to tell people what picture are they seeing, like a bookmark.  
And then when people clicks on another square white button, it becames  
red and the last one returns to white.  
I can make with diferent “Scenes”, but i want to make just in one scene.

I bit confusing:sigh:

Any help will be great.

---

<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:** [April 20, 2003, 12:34am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/2 "2003-04-20T00:34:46Z")

</div>

you could make the buttons using MovieClips with two frames, the first frame is the normal state and the second frame would be the selected state.

store the instance names of the buttons in an array. ie.

```auto
buttons = [button1, button2, button3, button4];

```

and you can use a function like this:

```auto
selectedButton = function() {
for (var b in buttons) this._parent[buttons**].gotoAndStop(1);
this.gotoAndStop(2);
};

```

as for the buttons…

```auto
button1.onRelease = function() {
statement(s);
this.selectedButton();
};

```

i didn’t test it, but that’s the idea. i guess i could set up an example for you if needed. 😉

---

<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:** [April 20, 2003, 1:24am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/3 "2003-04-20T01:24:46Z")

</div>

Hello again,

Can you please tell me where do i put this actionscript:

buttons = [button1, button2, button3, button4];

And this one? :

selectedButton = function() {  
for (var b in buttons) this.\_parent[buttons\*\*].gotoAndStop(1);  
this.gotoAndStop(2);  
};

Is it on the first frame where my Slide Movie clip is?

thanks 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:** [April 20, 2003, 1:35am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/4 "2003-04-20T01:35:23Z")

</div>

not necessarily the first frame, just put it before you actually use the buttons. 🙂

---

<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:** [April 20, 2003, 1:53am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/5 "2003-04-20T01:53:39Z")

</div>

You said:

“you could make the buttons using MovieClips with two frames, the first frame is the normal state and the second frame would be the selected state.”

But then how do i make this \_mc as buttons, i mean i convert them to buttons?  
And then where do i put the Movie Clip ?  
On the “UP”, “OVER” or “DOWN” state of the button symbol?

Sorry, but i have to make this clear on my head 😉

thanks.

---

<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:** [April 20, 2003, 2:03am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/6 "2003-04-20T02:03:15Z")

</div>

i guess you can put a Button symbol into the MovieClip symbol in the first frame, so you can have the up, over and down states. 😉

there are ways to make MovieClips behave as Buttons though, you can find one at [proto.layer51.com](http://proto.layer51.com)

---

<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:** [April 20, 2003, 3:01am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/7 "2003-04-20T03:01:55Z")

</div>

Hello again,

Sorry, but i just did a test , but doesn’t work…☹

If you can make an example and attach the .fla here would be a great  
help.  
If someone else has a clue about this issue, please help me out…

thanks

---

<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:** [April 20, 2003, 3:09am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/8 "2003-04-20T03:09:30Z")

</div>

it works. =)

```auto
MovieClip.prototype.createButton = function(x, y) {
	this.beginFill(0, 100);
	this.moveTo(x, y);
	this.lineTo(x+w, y);
	this.lineTo(x+w, y+h);
	this.lineTo(x, y+h);
	this.lineTo(x, y);
	this.endFill();
};
selectedButton = function () {
	for (b in buttons) this._parent[buttons**]._alpha = 100;
	this._alpha = 40;
};
var w = 40, h = 20, i, n = 4, s = 20, buttons = [], b;
for (i=0; i<n; i++) {
	this.createEmptyMovieClip("button"+i, i).createButton(w*i+s*i, s);
	this["button"+i].onRelease = selectedButton;
	buttons.push("button"+i);
}

```

i made that one because i didn’t feel like creating the symbols. 😛

---

<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:** [April 20, 2003, 3:33am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/9 "2003-04-20T03:33:57Z")

</div>

ok… here’s the file. 😉

---

<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:** [April 20, 2003, 3:58am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/10 "2003-04-20T03:58:04Z")

</div>

Thanks for the help!!🙂

I just test the file and its exactly how i want it,  
now im going to study this code…

Can you just tell me ,  
what part of this code makes the movieclip acts like a button?

thanks

---

<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:** [April 20, 2003, 4:04am UTC](https://forum.kirupa.com/t/problems-with-buttons-bookmark/18710/11 "2003-04-20T04:04:19Z")

</div>

ehmm… none? :-\

i told you that you can find a prototype at [http://proto.layer51.com](http://proto.layer51.com) not that i’d do that. 😉
