Mp3 player playhead progressbar not dragging

I’ve been working on a Mp3 play for the last month and at the last minute i decided to make it to where you could drag the playHead anywhere on the progress bar(loader.loadBar) MC and it would play where you dropped the playHead.

Well after a week of failed attempts, i decided to come to the masters and ask for advice or to see where i am screwing up. Here is my actionscript:

stop();
artist_txt.autoSize = “left”;
song_txt.autoSize = “left”;
timeDisplay_txt.autoSize = “left”;
toolTip._visible = false;
var amountLoaded:Number;
var duration:Number;
var pauseTime:Number = 0;
var stopped:Boolean = false;
playlist = new XML();
playlist.ignoreWhite = true;
playlist.onLoad = function(success) {
if (success) {
_global.songname = [];
_global.songband = [];
_global.songfile = [];
for (var i = 0; i<playlist.firstChild.childNodes.length; i++) {
_global.songname* = playlist.firstChild.childNodes*.attributes.name;
_global.songband* = playlist.firstChild.childNodes*.attributes.band;
_global.songfile* = playlist.firstChild.childNodes*.attributes.file;
// trace(songname*+" “+songfile*+” “+songband*);
}
}
_root.createEmptyMovieClip(“sound_mc”,1);
_global.song_nr = random(0);
_root.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]);
};
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, name, band) {
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() {
if (this.sound_obj.position>0) {
delete this.onEnterFrame;
this._parent.artist_txt.text = band;
this._parent.song_txt.text = name;
timeInterval = setInterval(timer, 1000, this.sound_obj);
} else {
this._parent.artist_txt.text = “loading…”;
this._parent.song_txt.text = “Please wait…”;
}
};
this.sound_obj.onSoundComplete = function() {
clearInterval(timeInterval);
this._parent.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],songname[song_nr],songband[song_nr]);
};
this._parent.volume1.dragger.onPress = function() {
startDrag(this, false, 0, this._y, this._parent.volBG._width, this._y);
_root.toolTip._visible = true;
setInterval(draggableTip,100);
function draggableTip() {
_root.toolTip._x = _root._xmouse;
}
this.onEnterFrame = function() {
var p = (this._x/this._parent.volBG._width)100;
this._parent._parent.sound_mc.sound_obj.setVolume§;
};
};
this._parent.volume1.dragger.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
};
this._parent.volume1.dragger.onReleaseOutside = function() {
_root.toolTip._visible = false;
stopDrag();
};
};
function soundStatus() {
var amountLoaded = (_root.sound_mc.sound_obj.getBytesLoaded()/_root.sound_mc.sound_obj.getBytesTotal());
_root.loader.loadBar._width = amountLoaded
393;
duration = _root.sound_mc.sound_obj.duration;
position = _root.sound_mc.sound_obj.position;
_root.playHead._x = position/duration411+326;
}
function pauseTrack():Void {
stopped = false;
pauseTime = _root.sound_mc.sound_obj.position/1000;
_root.sound_mc.sound_obj.stop();
updateAfterEvent();
}
playHead.onPress = function() {
_root.sound_mc.sound_obj.stop();
startDrag(this, false, 0, this._y, this._root.loader.loadBar._x, this._y);
onMouseMove = function () {
pauseTime = Math.floor(((this._root.loader.loadBar._x/this._root.loader.loadBar._width)
_root.sound_mc.sound_obj.duration)/1000);
updateAfterEvent();
};
};
playHead.onRelease = function() {
delete this.onEnterFrame;
stopDrag();
this._parent.sound_mc.sound_obj.start(pauseTime);
this._parent.sound_mc.sound_obj.play();
updateAfterEvent();
};
playHead.onReleaseOutside = function() {
this.stopDrag();
delete this.onMouseMove;
this._parent.sound_mc.sound_obj.start(pauseTime);
this._parent.sound_mc.sound_obj.play();
updateAfterEvent();
};
//Buttons
btn_play.onRelease = function() {
stopped = false;
if (pauseTime>0) {
stopped = false;
_root.sound_mc.sound_obj.play();
posiP = _root.sound_mc.sound_obj.position/1000;
pause = false;
this._parent.sound_mc.sound_obj.start(pauseTime);
btn_pause._visible = true;
btn_unpause._visible = false;
}
if (stopped == true) {
this._parent.sound_mc.sound_obj.start(pauseTime);
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = “00:00 - 00:00”;
this._parent.sound_mc.songStarter(songfile[song_nr],songname[song_nr],songband[song_nr]);
}
if (play == true) {
void(stopped);
}
};
btn_stop.onRelease = function() {
clearInterval(timeInterval);
this._parent.timeDisplay_txt.text = “00:00 - 00:00”;
this._parent.sound_mc.sound_obj.stop();
};
btn_fw.onRelease = function() {
clearInterval(timeInterval);
this._parent.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],songname[song_nr],songband[song_nr]);
this._parent.sound_mc.sound_obj.start(pauseTime);
};
btn_rev.onRelease = function() {
clearInterval(timeInterval);
this._parent.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],songname[song_nr],songband[song_nr]);
this._parent.sound_mc.sound_obj.start(pauseTime);
};
btn_pause.onRelease = function() {
stopped = false;
pauseTrack();
btn_pause._visible = false;
btn_unpause._visible = true;
};
btn_unpause.onRelease = function() {
_root.sound_mc.sound_obj.play();
posiP = _root.sound_mc.sound_obj.position/1000;
pause = false;
this._parent.sound_mc.sound_obj.start(pauseTime);
btn_pause._visible = true;
btn_unpause._visible = false;
};
btn_mute.onRelease = function() {
this._parent.sound_mc.sound_obj.setVolume(0);
btn_unmute._visible = true;
btn_mute._visible = false;
};
btn_unmute.onRelease = function() {
this._parent.sound_mc.sound_obj.setVolume(100);
btn_unmute._visible = false;
btn_mute._visible = true;
};
playlist.load(“playlist.xml”);
setInterval(duration,100);
setInterval(soundStatus,100);

if you need the fla file, let me know and i’ll upload it.

Thanks.