babytree mp3 player
[code]
//歌曲url,无指定时播放默认歌曲
if (!son) {
son = "http://cdn.babytree.com/img/goodies/babytree_song_solo.mp3";
}
//播放进度及转入进度条
var pos:Number;
var songloaded:Number
loaded._xscale = 1;
seeker._xscale = 1;
//播放按扭先隐藏
btnplay._visible = false;
//缓存时间
_soundbuftime = 10;
btnplay.onRelease = function() {
my_sound.start(mysposition,1);
btnplay._visible = false;
btnpause._visible = true;
clearInterval(my_interval);
my_interval = setInterval(checkProgress, 100, my_sound);
};
btnpause.onRelease = function() {
btnplay._visible = true;
btnpause._visible = false;
mysposition = my_sound.position/1000;
my_sound.stop();
};
btnreplay.onRelease = function() {
btnpause._visible = true;
my_sound.start(0,1);
seeker._xscale = 1;
clearInterval(my_interval);
my_interval = setInterval(checkProgress, 100, my_sound);
};
var my_sound:Sound = new Sound();
my_sound.onLoad = function(success:Boolean) {
if (success) {
}
};
my_sound.onSoundComplete = function() {
trace("Over!")
clearInterval(my_interval);
btnplay._visible = true;
};
my_sound.loadSound(son,true);
var my_interval:Number;
my_interval = setInterval(checkProgress, 100, my_sound);
function checkProgress(the_sound:Sound):Void {
songloaded = Math.round(the_sound.getBytesLoaded()/the_sound.getBytesTotal()*100);
pos = Math.round(the_sound.position/the_sound.duration*songloaded);
loaded._xscale = songloaded;
seeker._xscale = pos;
} [/code]
回复Comments
作者:
{commentrecontent}