Button stay in down state?

Hi,

I was wondering if it’s possible to have a button stay in the down state when a user clicks on it?

I’ve read that this is usually accomplished by replacing the button with a movie clip, but I’d rather not do that if possible as I’m on a deadline which is fast approaching.

So far I have a button with all states set with a gfx. I have named the but “but2”. I have placed the following code in a new layer, in the same frame as the button.

but2.onRelease = function () {
gotoAndStop(“hit”);
};

I read that this should make the button stay in the hit state on release. Only problem is it doesn’t seem to work!

on your up state, make your graphic a movie clip with 4 frames, one your original up state and the third and fourth with your down state graphics…
on frame 1 you want this AS

if(but2Down){
gotoAndPlay(2)
}

frame 2 have this:

gotoAndPlay(1)

frame 3 have

if(!but2Down){
gotoAndPlay(1)
}

frame 4 have this:

gotoAndPlay(3)

on your button add this on press or on release:

if(but2.but2Down){
but2.but2Down--
}
else{
but2.but2Down++
}

note im not entirely sure on the pathing there… if i were u id name ur up state mc as but2 as wel… just in case :wink:

will take u bout 5 mins at most all in all and should give you the effect you want :slight_smile:

Prophet.

Why even use a button? Just use a movie clip and have it stop at a selected frame.

Thanks! That helped alot!

@ditchhopper: thats why :wink:

Prophet.