2010-11-14 59 views
0

我正在努力与闪光灯文件,我想播放两个不同的声音文件,当适当的按钮被按下。 我已经把它加载到没有任何弹出错误的位置,但是当我按下该声音的按钮时,它不会播放第二个声音,它会再次播放第一个声音。 代码如下:不能获得第二个声音加载流MP3播放器

var sc1:SoundChannel = new SoundChannel(); 
var s1:Sound = new Sound(); 
s1.load(new URLRequest("http://www.website.com/wells.mp3")); 

wellsplay_btn.addEventListener(MouseEvent.CLICK,playSound); 
wellsstop_btn.addEventListener(MouseEvent.CLICK,stopSound); 

function playSound(e:MouseEvent):void 
{ 
sc1 = s1.play(); 
} 
function stopSound(e:MouseEvent):void 
{ 
sc1.stop(); 
} 

var sc2:SoundChannel = new SoundChannel(); 
var s2:Sound = new Sound(); 
s2.load(new URLRequest("http://www.website.com/waves.mp3")); 

wavesplay_btn.addEventListener(MouseEvent.CLICK,playSound); 
wavesstop_btn.addEventListener(MouseEvent.CLICK,stopSound); 

function playSound2(e:MouseEvent):void 
{ 
sc2 = s2.play(); 
} 
function stopSound2(e:MouseEvent):void 
{ 
sc2.stop(); 
} 

我很感激任何建议。

回答

0
wavesplay_btn.addEventListener(MouseEvent.CLICK,playSound2); 
wavesstop_btn.addEventListener(MouseEvent.CLICK,stopSound2); 
+0

哎呀,我希望我最终能做到这样的基本东西。谢谢。这使它工作。我认为我处于代码仍然是对我的旷野的阶段,所以我最终在圈子里游荡。但我正在通过教程 – Chris 2010-11-14 22:57:35

+0

感谢您的持续帮助。 – Chris 2010-11-14 23:02:22