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.