startDrag problems

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]