刷新流内容

时间:2014-09-23 09:37:16

标签: actionscript-3 flash

当播放时,它连接到流,它一切正常! 当我点击暂停btn它停止声音,但问题 是当你点击播放btn之后它开始从你停止它的同一个地方播放流,这样做所有时间都没有发生它总是从同一个地方开始流时第一次这样做...

play_btn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);
pause_btn.addEventListener(MouseEvent.CLICK, fl_ClickToPlayStopSound);

var fl_SC:SoundChannel = new SoundChannel;
var fl_ToPlay:Boolean = true;
var s:Sound = new Sound();
var req:URLRequest = new URLRequest("http://85.254.49.110:8002/radiov");
var context:SoundLoaderContext = new SoundLoaderContext(8000, true);


function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
    if(fl_ToPlay)
 {
    s.load(req, context);
    fl_SC = s.play();
    pause_btn.visible=true;
    play_btn.visible=false;
    spiner_mc.visible=true;

}
else
{
    fl_SC.stop();
    pause_btn.visible=false;
    play_btn.visible=true;
    spiner_mc.visible=true;
}
fl_ToPlay = !fl_ToPlay;

}

1 个答案:

答案 0 :(得分:0)

一切都很简单!

var fl_SC:SoundChannel = new SoundChannel;
var fl_ToPlay:Boolean = true;

function fl_ClickToPlayStopSound(evt:MouseEvent):void
{
    if(fl_ToPlay)
{
    var s:Sound = new Sound();
    var req:URLRequest = new URLRequest("http://85.254.49.110:8002/radiov");
    var context:SoundLoaderContext = new SoundLoaderContext(8000, true); 
    s.load(req, context); 
    fl_SC = s.play();
    pause_btn.visible=true;
    play_btn.visible=false;

 }
 else
 {
     fl_SC.stop();
     pause_btn.visible=false;
     play_btn.visible=true;
    }
    fl_ToPlay = !fl_ToPlay;
}

s:声音,请求,上下文和s.load不能放在外面,而且全部......