动态加载声音


layer1的action如下:
loadVariables("snd.txt", this);
num_next = 1;
snd1 = new Sound();
snd2 = new Sound();
snd1.loadSound("1.mp3", false);
snd2.loadSound("2.mp3", false);
snd3.loadSound("3.mp3", false);
snd1.start(0, 1);
num_next += 1;
stop();
snd1.onSoundComplete = function() {
if (_root.num_next<=_root.num_snd) {
snd2.start(0, 1);
num_next += 1;
} else {
_root.gotoAndPlay("a");
}
};
snd2.onSoundComplete = function() {
if (_root.num_next<=_root.num_snd) {
snd3.start(0, 1);
num_next += 1;
} else {
_root.gotoAndPlay("a");
}
};
snd3.onSoundComplete = function() {
if (_root.num_next<=_root.num_snd) {
snd4.start(0, 1);
num_next += 1;
} else {
_root.gotoAndPlay("a");
}
};

layer2的action如下:
stop();

snd.txt文件如下:
num_snd=3