# Combine button double click with drag function

**URL:** https://forum.kirupa.com/t/combine-button-double-click-with-drag-function/176745
**Category:** Uncategorized
**Created:** [January 26, 2006, 4:25pm UTC](https://forum.kirupa.com/t/combine-button-double-click-with-drag-function/176745 "2006-01-26T16:25:25Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![dirksmith](https://avatars.discourse-cdn.com/v4/letter/d/47e85d/32.png) [@dirksmith](https://forum.kirupa.com/u/dirksmith)
#### Post date: [January 26, 2006, 4:25pm UTC](https://forum.kirupa.com/t/combine-button-double-click-with-drag-function/176745/1 "2006-01-26T16:25:25Z")

</div>

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();

}
