function initsound ()
{
_root.player = new Sound ();
player.onSoundComplete = function ()
{
_root.playerstate = "loaded";
};
player.loadSound (_root.song_url, true);
}
function initsound ()
{
// create player object
_root.player = new Sound ();
player.onSoundComplete = function ()
{
_root.playstate = "stopped";
pausebuttn._visible = false;
player = undefined;
_root.stop ();
}
player.loadSound (_root.song_url, true);
}
this.onEnterFrame = function ()
{
bars_mc.loadline_mc._width = Math.round (100 * player.getBytesLoaded () / player.getBytesTotal ());
bars_mc.playline_mc._width = Math.round (100 * player.position / player.duration * player.getBytesLoaded () / player.getBytesTotal ());
};
loadline._width = Math.round (254 * player.getBytesLoaded () / player.getBytesTotal ());
playline._width = Math.round (254 * player.position / player.duration * player.getBytesLoaded () / player.getBytesTotal ());
bars_mc.progress_btn.onRelease = function ()
{
control_mc.gotoAndStop ("pause_pos");
play_position = _root.player.duration / _root.bars_mc.loadline_mc._width * this._xmouse / 1000;
player.start (play_position);
};
postn = _root.player.duration / _root.loadline._width * _xmouse / 1000;
_root.player.start (postn);
Source: https://habr.com/ru/post/6262/
All Articles