titul
02.03.2013, 11:51
Прошу помощи. Нужно чтобы воспроизведение начиналось сразу не нажимая play.
function loadData(success)
{
var _loc3 = this;
MySound.setVolume(curTrackVolume);
volumeControl.volumeMask._width = curTrackVolume / 2;
aPath = new Array();
songTitel = new Array();
imgsong = new Array();
audioTracks = new Array();
audioTracks.shuffle();
audioTracks = _loc3.firstChild.childNodes;
song_total = audioTracks.length;
for (var _loc2 = 0; _loc2 < song_total; ++_loc2)
{
aPath.push(audioTracks[_loc2].attributes.path);
songTitel.push(audioTracks[_loc2].attributes.title);
} // end of for
delete audioTracks;
delete data_xml;
} // End of the function
function listClick(prm)
{
delete pausepos;
current_song = prm;
MySound.stop();
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
playSong();
} // End of the function
function playSong()
{
var _loc2 = this;
AudioPath = aPath[current_song - 1];
song_url = AudioPath;
if (pausePos > 0)
{
MySound.start(pausePos, 0);
pausePos = 0;
}
else
{
MySound = new Sound();
MySound.loadSound(AudioPath, true);
MySound.setVolume(curTrackVolume);
MySound.onSoundComplete = function ()
{
current_song == song_total ? (current_song = 1) : (current_song++);
loadMovie("albume/img" + current_song + ".jpg", top.img_cover);
playSong();
};
} // end else if
} // End of the function
function checkDigits(toCheck)
{
var _loc1 = toCheck;
return (_loc1 < 10 ? (_loc1 = "" + _loc1, "" + _loc1) : (_loc1));
} // End of the function
function scrollTitle()
{
info.text = songTitel[current_song - 1];
} // End of the function
function time(value)
{
var _loc2 = Math.round(value);
_loc2 = _loc2 / 1000;
var _loc4 = Math.floor(_loc2 / 60);
var _loc3 = Math.floor(_loc2 % 60);
var _loc1 = "";
if (_loc4 < 10)
{
_loc1 = _loc1 + "0";
} // end if
_loc1 = _loc1 + (String(_loc4) + ":");
if (_loc3 < 10)
{
_loc1 = _loc1 + "0";
} // end if
_loc1 = _loc1 + String(_loc3);
return (_loc1);
} // End of the function
playlist == undefined ? (playlist = "info.xml") : (playlist = playlist);
stop ();
current_song = 1;
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);
pause_btn._visible = false;
pause_btn.enabled = false;
equ.e1.gotoAndStop(10);
equ.e2.gotoAndStop(10);
equ.e3.gotoAndStop(10);
equ.e4.gotoAndStop(10);
play_btn.onRelease = function ()
{
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
loadMovie(imgsong[current_song - 1], top.img_cover);
playSong();
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
pause_btn.onRelease = function ()
{
pausePos = MySound.position / 1000;
pause_btn._visible = false;
pause_btn.enabled = false;
play_btn._visible = true;
play_btn.enabled = true;
MySound.stop();
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
};
next_btn.onRelease = function ()
{
delete pausepos;
current_song == song_total ? (current_song = 1) : (current_song++);
loadMovie(imgsong[current_song - 1], top.img_cover);
MySound.stop();
playSong();
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
prev_btn.onRelease = function ()
{
delete pausepos;
current_song == 1 ? (current_song = song_total) : (current_song--);
loadMovie(imgsong[current_song - 1], top.img_cover);
MySound.stop();
playSong();
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
top.setMask(top_mask);
topup = true;
this.onEnterFrame = function ()
{
t_time.text = time(MySound.position) + "/" + time(MySound.duration);
if (t_time.text == "NaN:NaN/NaN:NaN")
{
t_time.text = "00:00/00:00";
} // end if
};
setInterval(scrollTitle, 40);
curTrackVolume = 50;
mof.mut_on.enabled = true;
mof.mut_on._visible = true;
mof.mut_off.enabled = false;
mof.mut_off._visible = false;
mof.mut_off.onRelease = function ()
{
mof.mut_on.enabled = true;
mof.mut_on._visible = true;
mof.mut_off.enabled = false;
mof.mut_off._visible = false;
volumeControl._visible = true;
MySound.setVolume(curTrackVolume);
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
mof.mut_on.onRelease = function ()
{
MySound.setVolume(0);
volumeControl._visible = false;
mof.mut_on.enabled = false;
mof.mut_on._visible = false;
mof.mut_off.enabled = true;
mof.mut_off._visible = true;
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
};
this.volumeControl.onPress = function ()
{
this.onEnterFrame = function ()
{
if (_xmouse >= volumeControl._x && _xmouse <= volumeControl._x + volumeControl._width)
{
curTrackVolume = Math.round(_xmouse - volumeControl._x) * 2;
volumeControl.volumeMask._width = curTrackVolume / 2;
MySound.setVolume(curTrackVolume);
final.text = curTrackVolume + "%";
equ._visible = true;
} // end if
};
};
final.text = curTrackVolume;
this.volumeControl.onRelease = function ()
{
delete volumeControl.onEnterFrame;
};
this.volumeControl.onReleaseOutside = function ()
{
delete volumeControl.onEnterFrame;
};
function loadData(success)
{
var _loc3 = this;
MySound.setVolume(curTrackVolume);
volumeControl.volumeMask._width = curTrackVolume / 2;
aPath = new Array();
songTitel = new Array();
imgsong = new Array();
audioTracks = new Array();
audioTracks.shuffle();
audioTracks = _loc3.firstChild.childNodes;
song_total = audioTracks.length;
for (var _loc2 = 0; _loc2 < song_total; ++_loc2)
{
aPath.push(audioTracks[_loc2].attributes.path);
songTitel.push(audioTracks[_loc2].attributes.title);
} // end of for
delete audioTracks;
delete data_xml;
} // End of the function
function listClick(prm)
{
delete pausepos;
current_song = prm;
MySound.stop();
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
playSong();
} // End of the function
function playSong()
{
var _loc2 = this;
AudioPath = aPath[current_song - 1];
song_url = AudioPath;
if (pausePos > 0)
{
MySound.start(pausePos, 0);
pausePos = 0;
}
else
{
MySound = new Sound();
MySound.loadSound(AudioPath, true);
MySound.setVolume(curTrackVolume);
MySound.onSoundComplete = function ()
{
current_song == song_total ? (current_song = 1) : (current_song++);
loadMovie("albume/img" + current_song + ".jpg", top.img_cover);
playSong();
};
} // end else if
} // End of the function
function checkDigits(toCheck)
{
var _loc1 = toCheck;
return (_loc1 < 10 ? (_loc1 = "" + _loc1, "" + _loc1) : (_loc1));
} // End of the function
function scrollTitle()
{
info.text = songTitel[current_song - 1];
} // End of the function
function time(value)
{
var _loc2 = Math.round(value);
_loc2 = _loc2 / 1000;
var _loc4 = Math.floor(_loc2 / 60);
var _loc3 = Math.floor(_loc2 % 60);
var _loc1 = "";
if (_loc4 < 10)
{
_loc1 = _loc1 + "0";
} // end if
_loc1 = _loc1 + (String(_loc4) + ":");
if (_loc3 < 10)
{
_loc1 = _loc1 + "0";
} // end if
_loc1 = _loc1 + String(_loc3);
return (_loc1);
} // End of the function
playlist == undefined ? (playlist = "info.xml") : (playlist = playlist);
stop ();
current_song = 1;
data_xml = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = loadData;
data_xml.load(playlist);
pause_btn._visible = false;
pause_btn.enabled = false;
equ.e1.gotoAndStop(10);
equ.e2.gotoAndStop(10);
equ.e3.gotoAndStop(10);
equ.e4.gotoAndStop(10);
play_btn.onRelease = function ()
{
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
loadMovie(imgsong[current_song - 1], top.img_cover);
playSong();
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
pause_btn.onRelease = function ()
{
pausePos = MySound.position / 1000;
pause_btn._visible = false;
pause_btn.enabled = false;
play_btn._visible = true;
play_btn.enabled = true;
MySound.stop();
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
};
next_btn.onRelease = function ()
{
delete pausepos;
current_song == song_total ? (current_song = 1) : (current_song++);
loadMovie(imgsong[current_song - 1], top.img_cover);
MySound.stop();
playSong();
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
prev_btn.onRelease = function ()
{
delete pausepos;
current_song == 1 ? (current_song = song_total) : (current_song--);
loadMovie(imgsong[current_song - 1], top.img_cover);
MySound.stop();
playSong();
pause_btn._visible = true;
pause_btn.enabled = true;
play_btn._visible = false;
play_btn.enabled = false;
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
top.setMask(top_mask);
topup = true;
this.onEnterFrame = function ()
{
t_time.text = time(MySound.position) + "/" + time(MySound.duration);
if (t_time.text == "NaN:NaN/NaN:NaN")
{
t_time.text = "00:00/00:00";
} // end if
};
setInterval(scrollTitle, 40);
curTrackVolume = 50;
mof.mut_on.enabled = true;
mof.mut_on._visible = true;
mof.mut_off.enabled = false;
mof.mut_off._visible = false;
mof.mut_off.onRelease = function ()
{
mof.mut_on.enabled = true;
mof.mut_on._visible = true;
mof.mut_off.enabled = false;
mof.mut_off._visible = false;
volumeControl._visible = true;
MySound.setVolume(curTrackVolume);
equ.e1.play();
equ.e2.play();
equ.e3.play();
equ.e4.play();
};
mof.mut_on.onRelease = function ()
{
MySound.setVolume(0);
volumeControl._visible = false;
mof.mut_on.enabled = false;
mof.mut_on._visible = false;
mof.mut_off.enabled = true;
mof.mut_off._visible = true;
equ.e1.stop();
equ.e2.stop();
equ.e3.stop();
equ.e4.stop();
};
this.volumeControl.onPress = function ()
{
this.onEnterFrame = function ()
{
if (_xmouse >= volumeControl._x && _xmouse <= volumeControl._x + volumeControl._width)
{
curTrackVolume = Math.round(_xmouse - volumeControl._x) * 2;
volumeControl.volumeMask._width = curTrackVolume / 2;
MySound.setVolume(curTrackVolume);
final.text = curTrackVolume + "%";
equ._visible = true;
} // end if
};
};
final.text = curTrackVolume;
this.volumeControl.onRelease = function ()
{
delete volumeControl.onEnterFrame;
};
this.volumeControl.onReleaseOutside = function ()
{
delete volumeControl.onEnterFrame;
};