方法多多:
一、动画第一帧上动作:stop();
方法一:
按钮层第一帧:n=0;
按钮上代码:
on(release){
n=n+1;
if(n%2==0){
stop();
}
else{
play();
}
方法二:
做一个按钮放在动画(MC)里,点击按钮写如下动作:
on(release){
if(!isplay){
this.play();
this.isplay=1;
}
else{
this.stop();
delete this.isplay;
}
}
方法三:
设置两个按钮,第一个为停止,第二个为播放,大小相同,位置相同。 二、一个按钮实现背景音乐的播放与停止
1 先做一个动画
2 首先在第一帧上加入命令
music = new Sound();
music.attachSound("music");
3 导入声音文件到库中,右键选择链接,设定链接名为music
4 在你的播放和暂停按钮(他们是一个按钮)上加入下面的命令:
on (release) {
n = n+1;
if (n%2==0) {
play();
music.start(0,3);
}
else {
stop();
music.stop();
}
|
|