求救,关于加载mp3的问题
//加载声音mysound.addEventListener(MouseEvent.MOUSE_DOWN,sound_down)
function sound_down(e:MouseEvent):void{
var _sound:Sound=new Sound();
_sound.load(new URLRequest("song.mp3"));
_sound.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(e:Event):void{
e.target.play();
}
在这我加载了一首mp3,但我想实现的是当我再次点击mysound这个按钮时能再重新加载、播放当前声音,也就是想实现当再次点击mysound时能卸载当前声音 mysound.addEventListener(MouseEvent.MOUSE_DOWN,sound_down);
var p_channel:SoundChannel =new SoundChannel;
var p:Boolean =true;
function sound_down(e:MouseEvent):void {
var _sound:Sound=new Sound();
_sound.load(new URLRequest("song.mp3"));
_sound.addEventListener(Event.COMPLETE, completeHandler);
}
function completeHandler(e:Event):void {
p_chanle.stop;
if (p) {
var _sound:Sound =e.target as Sound;
p_channel=_sound.play();
p=false;
return;
}
p=true;
} 偶会!!!:b36
页:
[1]
