Combine button double click with drag function

Hi

I’m trying to combine a mc button’s drag functionality with a double click functionality.

I have the actionscript to do both - with the drag aspect working fine - but I’m having problems getting the double click to work too - basically meshing the respective scripts.

Tried variations on combining the scripts but nothing working so far - grateful for any help on getting this right.

The script is below

Thanx

//double click: set initial variables
click = false;

//function for the button press
this.onPress = function() {
//if this is the first click
if (!click) {
timer = getTimer()/1000;
_root.click = true;
}
else {
timer2 = getTimer()/1000;
//if it is a double click
if ((timer2-timer)<.25) {
//toggle the box mc on and off
if (this._visible==false) {
this._visible = true;
} else {
this._visible = false;
}
} else {
timer = getTimer()/1000;
_root.click = true;
}
}
};

on (press) {
//Start Dragging Movieclip Behavior
startDrag(this, false, 168, 224, 564, 476);
this.swapDepths(this._parent.getNextHighestDepth());
n=this.getDepth();
_root.introBox.swapDepths(n+1);
//End Behavior

}
on (release,rollOut) {
stopDrag();

}