闪光音乐播放器第二次播放后不播放

时间:2013-07-04 16:00:18

标签: flash-cs5 flash

我是flash的新手。我为我的在线广播创建了flash播放器。当我使用停止和播放按钮时,它首先正常工作两次。第三次不玩。我不知道为什么不玩,我使用动作脚本3.0,我的动作脚本在这里

import flash.events.MouseEvent;
import flash.media.Sound;
import flash.net.URLRequest;
import flash.media.SoundChannel;
import fl.events.SliderEvent;

// objects

var soundfile:URLRequest = new URLRequest('http://www.xxx.com:80/;stream1.mp3');
var channel:SoundChannel = new SoundChannel();
var sTransform:SoundTransform = new SoundTransform();

// controls 
btnplay.addEventListener(MouseEvent.CLICK,playmusic);
btnstop.addEventListener(MouseEvent.CLICK,stopmusic);
sldVolume.addEventListener(SliderEvent.CHANGE,changevolume);

function playmusic(evt:MouseEvent):void
{
    var myMusic:Sound = new Sound();
    myMusic.load(soundfile);
    myMusic.play();

}
function changevolume(evt:SliderEvent):void
{
    sTransform.volume = sldVolume.value;
    channel.soundTransform = sTransform;
}

function stopmusic(evt:MouseEvent):void
{
    sldVolume.removeEventListener(Event.COMPLETE, changevolume);
    SoundMixer.stopAll();
}

0 个答案:

没有答案