Disabling buttons once pressed


I’m another newbie getting started with Flash 5. I think I’m making some good progress on the basics thanks to kirupa.

I was wondering how to ghost a button once its been pressed and how to reactivate it later with the press of another button or after the movie clip it is linked to has finshed?

I’m sure there are many ways to do it… I can’t work them out just yet… whats the easliest one ?



To do that you’re going to need to control a movie clip with the button. Do you know how to do that yet?

second question… are your buttons squarish or roundish in shape?

third question, do you have hit states set for the button’s 2nd and 3rd frames?

Yep, I’ve got my buttons sorted ! I used some standard library ones cos I’m still trying things out.

I’ll post the effort in this reply…

The file is lacking imagination I know but its a start…

basically I’ve got the play button tell targeted to a movie clip with the only the sound on it.

and the stop button with the command on (release) stop all sounds.

trouble is that the play button can be pressed several times creating a medely where I don’t want one.

So I would like to get the play button to stay down until the sound is finished unless interupted by the stop button!



Well I can tell you right off the bat that you can place another ‘stop all sounds’ before the ‘play’ action on the play button. That will clear anything that’s running before the sound begins playing.

The button, actually remaining down while it’s playing will be a little more tricky I suppose.

What I would do, if I were you, would be to start right out controling more movie clips. It’s good experience. You’re going to read this and say,… omg. that’s too complex. But really it’s not. Take it one step at a time. If one step stumps you, ask… I’ll clarify.

Create a square of fill. Select it and hit F8. Select button and hit “ok”. Double click the button you just created to bring up it’s timeline. Select frame one and drag it to frame four. The first three frames should be completely empty.
Go back to the main timeline. You’ll see a pale blue silouette of the button you just made. This is an invisible button. It has no image associated with it at all, and does not show up on the stage in production. It does however have a hit spot so it can be clicked on.

Transfer the code from your current button to this invisible button. Just select it, copy/cut, select the invis button then the action panel, then paste.

Select your origional button. In the “Instance” panel, change it from a button to a movie clip. give it an instance name in this box. do not use “play” or “stop” as these words may be used by Flash for something. I’ll use “ply” for the play button and “stp” for the stop button. With the instance names in place and both set as movie clips you can now call to them to make them play, just like you did with the sound movie clip.

There is a problem. The movie clips start playing right off the bat. You could go into each and set a stop() action on the first frame but you could also attach code to the outside of the movie clip which is easier.


simply stops the clip as soon as it loads up on the stage.
If you’re unfamiliar with attaching code to movie clips, it’s really just the same as attaching code to buttons.

Then all you need to do is add to your button, some code.

//mySoundClip is a generic name.
//sets trip to keep play button down.
//sets trip to allow play button to raise.

a second invisible button can be placed for the ‘stp’ clip and have the following code


The last thing you want to do is set some code on the last frame of the sound containing movie clip. That would be

//it’s redundant… but sometimes redundancy is good
sends the play clip back to frame 1
//send the sound clip’s playhead back to frame 1.

Well… this all looks a lot more complex than I wanted it to be. It really is quite easy to do once you get the hang of it. Try it out… like I said. I’ll answer any questions that come up.

Thanks I *really * appreciate your quick reply.

I’m working my way though that now.

Just thought I’d let you know, I read you introduction in the erm… “introduction topic” and you were banging on about first person shooters.

I wonder if you’ve played Soldier of Fortune at all. Its really good in multiplayer with many different game types… CTF, CTB, DM, RDM among others.

I’d recommend it however I currently can’t get it to work on my system under winXP … it was great under Win98.


Yes, I’ve gone through SOF quite a bit. I enjoyed very much, not only having hit location, but hit spot disabling of limbs and such. The neccessity to limp along when your leg got shot is very cool.

Arrrrrrgh dam forum…

I just wrote **** loads of stuff about how my problem is progressing… clicked the post button… (It failed) and then when I pressed back the whole thing was gone!

Right I’ll be breifer this time and use bullet points!

o) I can’t get it to work although I’ve had some success controling movieclips with invisable buttons - but not in this file for some reason.

o) The buttons just ain’t responding.

o) See attached .fla file for a good laugh at my attempts.

Thanks again.


PS: I haven’t attached the file after all cos its too big. dammmit.

so I’ve uploaded it to geocities.


its about 452Kb (cos of the lenghy sound clip!)

Hi. I did this alot when making my one my games…

ok first I have to aplogize because I’m short on time and I didn’t get to read through all of your’s and david’s previous posts.

What I do is create a movie clip, with two frames. In the first frame is the working button. In the second frame is a graphic of the button. When the button is pressed, its action is performed, and it tells the movie clip it’s in to go to the second frame… deactivating it.

I also read something about a sound
if you want it to deactivate only while a sound is playing, do the same as above. Make the sound streamed inside a movie clip stopped on frame 1. When the button is pressed the sound will play and it will deactivate. At the end of the sound movie clip, put another tell target telling the button movie clip to go back to frame 1.

hope that makes sense.

Can you help me a bit…

I’m wondering how to tell target on the “parent” movie clip ie. the one that called the tune to get it to move to frame 2 and stop.

I can’t find a way to instance name the first scene. I’m probably going about it the wrong way… but I’m so close to getting it to work.

I’ve to everything hooked up apart for the disabled button.

Much appreciated.


(Lame Newbie Flasher)