The answer above has been answered using the most standard project development method. Here I will use a method that beginners can understand:
Create a video clip, and then put the music into the video clip. On the frame, set the sound synchronization attribute to data stream, extend the timeline until the music playback is completed
Put the video clip on the stage, and set the instance name to music_mc
Create a Button, used for control, set the instance name to btn
Add the following code to the timeline:
var isPlay:Boolean=true;
btn.addEventListener( MouseEvent.CLICK,ChangeMusicState);
function ChangeMusicState(e:MouseEvent):void
{
if(isPlay==true)
< p>{isPlay=false;
music_mc.stop();
}
else
{
isPlay=true;
music_mc.play();
}
}
Please click Enter the image description. If you have any questions about FLASH or Animate operation and code, you can send me a private message and I will try my best to answer them!