Problems with buttons bookmark...!

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.

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.

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

and you can use a function like this:

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

as for the buttons…

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. :wink:

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

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

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 :wink:

thanks.

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. :wink:

there are ways to make MovieClips behave as Buttons though, you can find one at proto.layer51.com

Hello again,

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

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

it works. =)

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. :stuck_out_tongue:

ok… here’s the file. :wink:

Thanks for the help!!:slight_smile:

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

ehmm… none? :-\

i told you that you can find a prototype at http://proto.layer51.com not that i’d do that. :wink: