主题:  声音控制

1399866

职务:普通成员
等级:2
金币:1.0
发贴:263
注册:2002/8/21 22:27:46
#12002/9/25 18:43:27
我现在有这样一个问题,有一个动画,有背景音乐和控制声音按钮,进入时背景音乐响,当点击按钮时,背景音乐停止,音乐播放,再点击时音乐停止,背景音乐播放,如此循环,这里有我的源代码,只是一部分,请大家帮忙
on (release) {
    if ((status == 0) || (status == null)) {
        stopAllSounds();
        snd.start(0, 9999);
        tellTarget ("per") {
            nextFrame();
        }
        status = 1;
    } else {
        snd.stop();
        tellTarget ("per") {
            prevFrame();
        }
        status = 0;
    }
}

这是按钮。


snd = new Sound();
snd.attachSound("shw");
var 开关 = false;
kaiguan.onrelease = function() {
    if (开关) {
        snd.stop();
        this.prevframe();
        开关 = false;
    } else {
        snd.start(0, 999);
        this.nextframe();
        开关 = true;
    }
};
这是第一帧的代码。还有一个电影夹子开关,在第一帧有stop();


谢谢