然而,几年前我把它放在一起,我想我可能正在考虑如何同时播放多个声音。不幸的是它只播放8个声音然后停止。如何在没有任何实例限制的情况下使此Flash脚本播放声音?
import flash.external.*;
ExternalInterface.addCallback('splayerSound', null, playsound);
ExternalInterface.addCallback('splayerStop', null, stopsound);
function playsound(param)
{
var p = param.split('&');
if (p[1]=='0') {sound0 = new Sound(sound0); sound0.loadSound(p[0],true);}
else if (p[1]=='1') {sound1 = new Sound(sound1); sound1.loadSound(p[0],true);}
else if (p[1]=='2') {sound2 = new Sound(sound2); sound2.loadSound(p[0],true);}
else if (p[1]=='3') {sound3 = new Sound(sound3); sound3.loadSound(p[0],true);}
else if (p[1]=='4') {sound4 = new Sound(sound4); sound4.loadSound(p[0],true);}
else if (p[1]=='5') {sound5 = new Sound(sound5); sound5.loadSound(p[0],true);}
else if (p[1]=='6') {sound6 = new Sound(sound6); sound6.loadSound(p[0],true);}
else if (p[1]=='7') {sound7 = new Sound(sound7); sound7.loadSound(p[0],true);}
}
function stopsound()
{
sound0.stop();
delete sound0;
var sound0:Sound = new Sound();
sound1.stop();
delete sound1;
var sound1:Sound = new Sound();
sound2.stop();
delete sound2;
var sound2:Sound = new Sound();
sound3.stop();
delete sound3;
var sound3:Sound = new Sound();
sound4.stop();
delete sound4;
var sound4:Sound = new Sound();
sound5.stop();
delete sound5;
var sound5:Sound = new Sound();
sound6.stop();
delete sound6;
var sound6:Sound = new Sound();
sound7.stop();
delete sound7;
var sound7:Sound = new Sound();
}