Hi i am trying to put my xml playlist into a scrollpane so that the number of tracks loaded doesnt matter and it will fit whatever,
I can find a way to make the content of the scroll realise its needs to be bigger, i have attached my FLA and below is the action script that controls the whole project
I have put a ScrollPane instance on the root and then created an empty movie clip and then set that as the content for the scrollPane
Thanks in advance im all out of ideas
Here is link to project file
http://www.hitandhopedesigns.com/mp3playlist.zip
Rob
stop();
title_txt.autoSize = "left";
timeDisplay_txt.autoSize = "left";
var amountLoaded:Number;
var duration:Number;
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
if (success) {
_global.songname = [];
_global.songartist = [];
_global.songproduced = [];
_global.songfile = [];
_global.songcover = [];
for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname* = playlist.firstChild.childNodes*.attributes.name;
_global.songproduced* = playlist.firstChild.childNodes*.attributes.produced;
_global.songartist* = playlist.firstChild.childNodes*.attributes.artist;
_global.songfile* = playlist.firstChild.childNodes*.attributes.file;
_global.songcover* = playlist.firstChild.childNodes*.attributes.cover;
scroller.content.attachMovie("butTemp","but"+i,i+50);
_root.scroller.content["but"+i].id=i;
_root.scroller.content["but"+i].trackover._visible = false;
_root.scroller.content["but"+i].trackover2._visible = false;
_root.scroller.content["but"+i]._x = -2;
_root.scroller.content["but"+i]._y = 10 + (i*59);
_root.scroller.content["but"+i].but_txt.text = songname*;
_root.scroller.content["but"+i].but_txt2.text = songartist*;
_root.scroller.content["but"+i].but_txt3.text = songproduced*;
_root.scroller.content["but"+i].onRelease = function(){
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
_root.sound_mc.songStarter(songfile[this.id]);
loadMovie(songcover[this.id], picLoader);
}
_root.scroller.content["but"+i].onRollOver = function(){
this.trackover._visible = true;
}
_root.scroller.content["but"+i].onRollOut = function(){
this.trackover._visible = false;
}
}
}
_root.createEmptyMovieClip("sound_mc", 1);
_global.song_nr = random(songfile.length);
_root.sound_mc.songStarter(songfile[song_nr]);
updateCover();
};
function timer(sound_obj) {
time = sound_obj.position/1000;
min = Math.floor(time/60);
min = (min<10) ? "0"+min : min;
sec = Math.floor(time%60);
sec = (sec<10) ? "0"+sec : sec;
timeDisplay_txt.text = min+":"+sec+"/"+totalDuration;
}
function duration (){
timed = _root.sound_mc.sound_obj.duration/1000;
mind = Math.floor(timed/60);
mind = (mind<10) ? "0"+mind : mind;
secd = Math.floor(timed%60);
secd = (secd<10) ? "0"+secd : secd;
totalDuration = mind+":"+secd;
}
MovieClip.prototype.songStarter = function(file) {
var CurrentVolume = _root.sound_mc.sound_obj.getVolume();
if(CurrentVolume <=0) {
CurrentVolume = 100
}
if (this.sound_obj) {
this.sound_obj.stop();
delete this.sound_obj;
}
this.sound_obj = new Sound(this);
this.sound_obj.loadSound(file, true);
this.onEnterFrame = function() {
this.sound_obj.setVolume(CurrentVolume);
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
timeInterval = setInterval(timer, 1000, this.sound_obj);
track = this.sound_obj.id3.songname;
artist = this.sound_obj.id3.artist;
this._parent.title_txt.text =songname;
} else {
this._parent.title_txt.text = "loading...";
}
};
this.sound_obj.onSoundComplete = function() {
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr]);
};
this._parent.volume1.dragger.onPress = function() {
startDrag(this, true, 0, this._y, this._parent.volBG._width, this._y);
this.onEnterFrame = function() {
var p = (this._x/this._parent.volBG._width)*100;
this._parent._parent.sound_mc.sound_obj.setVolume(p);
};
}
this._parent.volume1.dragger.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
if(_root.volume1.dragger._x < 122.0 && _root.volume1.dragger._x > 113.0) {
greenlight._visible = true;
}else {
greenlight._visible = false;
}
};
this._parent.volume1.dragger.onReleaseOutside = function() {
stopDrag();
};
};
btn_play.onRelease = function() {
if (pause == true){ // no comment....
this._parent.sound_mc.sound_obj.start(posiP) // start sound from the previously saved position
}
else {
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
this._parent.sound_mc.songStarter(songfile[song_nr]);
}
};
btn_stop.onRelease = function() {
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
this._parent.sound_mc.sound_obj.stop();
};
btn_dwn.onRelease = function() {
getURL(songfile[song_nr], "_blank");
};
btn_fw.onRelease = function() {
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
(song_nr == songfile.length-1) ? _global.song_nr=0 : _global.song_nr++;
_root.sound_mc.songStarter(songfile[song_nr]);
updateCover();
};
btn_rev.onRelease = function() {
clearInterval(timeInterval);
_root.timeDisplay_txt.text = "00:00/00:00";
(song_nr == 0) ? _global.song_nr=songfile.length-1 : _global.song_nr--;
_root.sound_mc.songStarter(songfile[song_nr]);
updateCover();
updatebutton();
};
btn_pause.onRelease = function() { //pause button function
if (pause == true){ // no comment....
this._parent.sound_mc.sound_obj.start(posiP) // start sound from the previously saved position
pause = false;//set the variable pause to true
}
else {
this._parent.sound_mc.sound_obj.stop(); //stop the current sound
posiP = _root.sound_mc.sound_obj.position / 1000; // save the current position in a new variable and divide by 1000 (ms -> sec)
pause = true;//set the variable pause to true
}
}
function updateCover(){
loadMovie(songcover[song_nr], picloader);
}
playlist.load("playlist.xml");
setInterval(duration,100);
setInterval(soundStatus,100);