# STOP DRAG() - Not Stopping!

**URL:** <https://forum.kirupa.com/t/stop-drag-not-stopping/254111>\
**Category:** Uncategorized\
**Created:** [March 8, 2008, 3:28am UTC](https://forum.kirupa.com/t/stop-drag-not-stopping/254111 "2008-03-08T03:28:27Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ibex](https://avatars.discourse-cdn.com/v4/letter/i/ecc23a/32.png) [@ibex](https://forum.kirupa.com/u/ibex)\
**Post date:** [March 8, 2008, 3:28am UTC](https://forum.kirupa.com/t/stop-drag-not-stopping/254111/1 "2008-03-08T03:28:27Z")

</div>

Hi,

Can someone take a quick look at this code below and tell me why the object being dragged does not drop…and stays stuck to the mouse pointer?

Thanks…

function addOne() {  
\_root.selected = this.duplicateMovieClip(this.\_name+(++this.num), depth++);  
\_root.selected.startDrag(true);  
\_root.selected.onPress = grabit;  
\_root.selected.onRollOver = selectit;  
\_root.selected.onRollOut = deselectit;  
\_root.selected.onRelease = dropit;  
\_root.names[\_root.names.length] = " "+\_root.selected.\_name;  
upDate();  
}  
function selectit() {  
\_root.selected = this;  
this.\_alpha = 50;  
}  
function deselectit() {  
\_root.selected = null;  
this.\_alpha = 100;  
}  
function grabit() {  
this.startDrag(false);

}  
function dropit() {  
this.stopDrag();

}  
function onKeyDown() {  
if (Key.getCode() == “D”.charCodeAt(0) && \_root.selected != null) {  
var p = \_root.selected.\_name;  
var s = " "+\_root.names.toString();  
var n = s.indexOf§;  
\_root.names = (s.substring(1, n)+s.substring(n+p.length+2, s.length)).split(’,’);  
if (n+p.length+2\>=s.length) {  
\_root.names.length–;  
}  
\_root.selected.removeMovieClip();  
\_root.selected = null;  
upDate();  
}  
}  
function dropnew() {  
\_root.selected.stopDrag();

}  
function upDate() {  
\_root.currentnames = \_root.names.toString();  
\_root.currentnames = \_root.currentnames.substring(1, \_root.currentnames.length);  
}  
Key.addListener(this);  
depth = 0;  
names = [];  
things = [circle,square,triangle];

for (var i = 0; i\<things.length; i++) {  
things\*.onPress = addOne;  
things\*.onReleaseOutSide = dropnew;  
}  
stop();

:be:
