Tracking a button state?

Mildly newbie with AS 2.0 here. I’m currently building an interactive movie style slide show in flash8.

I’m having trouble figuring out how to get flash to recognize if a button is being clicked and dragged or not. This is for a progress bar slider that runs along the bottom of the slideshow and shows progress. The user can click on the bar anywhere and the the movie jumps to that location. The user can also drag the playhead button along the bar and when s/he releases it the movie jumps to that location.

However when I implement the code for having the playhead button follow with the progress bar, it conflicts when the user tries to drag it.

Here is the code currently.


var progressBar:Number;
var count:Number = 0;
var duration:Number = 50;

//this is how the bar tracks the current play head
function playHead():Void {
    duration_played = Math.round(_root._currentframe);
    duration_total = Math.round(_root._totalframes);
    getPercent = duration_played/duration_total;
    phead_mc._width = getPercent*ptrack_mc._width;
//I can get the playhead button to follow this playhead by simply adding:
//pbutton_mc._x = getPercent*ptrack_mc._width
    }

progressBar = setInterval(this, "playHead", duration);

//this is for clicking on the playbar to go to a specific position
function playPos():Void {
    track_pos = Math.round(ptrack_mc._xmouse);
    track_total = Math.round(ptrack_mc._width);
    trackPercent = track_pos/track_total;
    _root.gotoAndPlay(trackPercent*_root._totalframes);
    _root.readmore_mc.gotoAndStop("readmore");
    _root.playpause_mc.gotoAndStop("pause");
    _root.flicker_mc.play();
    if (_root.info_mc._currentframe>=2) {
        _root.info_mc.gotoAndPlay("36");
    }
    trace(trackPercent*_root._totalframes);
}

ptrack_mc.onPress = playPos;
    
//this bit is for my dragable play button that I want to follow the play head when it's not being dragged.
function dragPlay():Void {
    startDrag(this, false, ptrack_mc._x, this._y, ptrack_mc._width, this._y);
};

pbutton_mc.onPress = dragPlay;

pbutton_mc.onRelease = function() {
    stopDrag();
    playHead();
    playPos();
};

So I’m guessing that I need to set up an if - else statement that relates to wether or not the pbutton_mc is being dragged or not. But I’m not sure how to do that.

if (pbutton_mc.onMouseDown = true)???
but where do I put it? do I need a mouseListener object?

Do I need to restructure what functions are doing what?

Any help would be greatly appreciated.