# startDrag problems

**URL:** <https://forum.kirupa.com/t/startdrag-problems/158450>\
**Category:** flash\
**Created:** [August 9, 2005, 8:15pm UTC](https://forum.kirupa.com/t/startdrag-problems/158450 "2005-08-09T20:15:10Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![soccerguy](https://avatars.discourse-cdn.com/v4/letter/s/e36b37/32.png) [@soccerguy](https://forum.kirupa.com/u/soccerguy)\
**Post date:** [August 9, 2005, 8:15pm UTC](https://forum.kirupa.com/t/startdrag-problems/158450/1 "2005-08-09T20:15:10Z")

</div>

I’m having a heck of a problem with the startDrag function in Flash right now. I’m trying to make a draggable and/or clickable curtain rope, which works now to a certain extent. When the user single clicks on the rope, it opens/closes itself. When a user clicks and drags the rope part of the way, it opens/closes itself the rest of the distance. A user can also click and drag the rope the whole way if they like. Everything does what it is supposed to when a user single clicks. If a user double clicks, the curtain is permanently draggable, which is obviously not what I’m going for. My code is below, thanks in advance for any tips/suggestions.

[font=Courier New]// Variable used to determine whether the curtain goes up or down  
drag = 1[/font]  
[font=Courier New]// Starts the dragging  
slider\_mc.rope\_mc.onPress = function() {  
slider\_mc.startDrag(false, -8, -250, -8, -20)  
}[/font]

[font=Courier New]// Stops the dragging  
slider\_mc.rope\_mc.onRelease = function() {  
slider\_mc.stopDrag()  
// Grabs the current y coordinate of the curtain  
endy = slider\_mc.\_y  
// Starts an Actionscript tween function  
tweenRope(mx.transitions.easing.Regular.easeOut)  
// The tween function  
function tweenRope(easeType) {  
if (drag == 1) {  
// Makes the curtain go down  
begin = endy  
end = -20  
drag = 0  
} else if (drag == 0) {  
// Makes the curtain go up  
begin = endy  
end = -250  
drag = 1  
}  
// Controls the speed of the tween  
time = 20  
mc = slider\_mc  
// Performs the actual tween  
ropeTween = new mx.transitions.Tween(mc, “\_y”, easeType, begin, end, time)  
}  
}[/font]
