Button | Control just asked me how to control the start and stop of sound in Flash. At first, I want to stop and play with the button, OK? Try again to remember that the sound cannot be so controlled. If you want to know how to do it, please look down. Show:
Click here to download the source file
First prepare your material: sound file (not too big OH), do an animation and then pull out a button from the library.
Here we go. Position the actors first. I put it like this, layer one animation, take a name is called Animation bar. Layer Two-place button. Layer three to put the sound. (In fact, the location is casual). Let's put the actors up. See figure below:
Right click on your voice inside the library, select "Link ..."
In the pop-up dialog box to do the following settings:
In coming to the main scene. At the first frame of the sound layer, open the Action panel (press F9) and write the following code in the Action window:
s = new Sound ();
S.attachsound ("Music");
S.stop ();
Click on the first frame of the animation layer and write in the action panel:
Stop (); Finally click on the button in the button's action panel to write:
On (release) {
S.start ();
Play ();
}
All right, finish it, try the effect. It's so simple. (To make a button to stop the sound, put S.start (); Change to S.stop (); it's OK. )
Note: This animation can only be made in flashMX2004 or later versions. Because this is the grammar of AS2.0. The master saw don't laugh at me oh.