# Drag drop problem

**URL:** https://forum.kirupa.com/t/drag-drop-problem/300917
**Category:** Uncategorized
**Created:** [November 30, 2009, 2:20pm UTC](https://forum.kirupa.com/t/drag-drop-problem/300917 "2009-11-30T14:20:58Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![lope](https://avatars.discourse-cdn.com/v4/letter/l/43a26b/32.png) [@lope](https://forum.kirupa.com/u/lope)
#### Post date: [November 30, 2009, 2:20pm UTC](https://forum.kirupa.com/t/drag-drop-problem/300917/1 "2009-11-30T14:20:58Z")

</div>

not so much a problem as something is bugging me…

the problem is that mc is actually a 2px wide line so if i attach mouse\_out listener as in code below, when mouse gets out of that line (which happen too easily and always) the dragging stops.  
and if i dont attach mouse\_out listener then if i drag out of the stage and let go i get an error (which i could catch) but also mc stays locked to my mouse although its not mouse\_down any more till i click again…

```auto
mc.addEventListener(MouseEvent.MOUSE_DOWN, startDragging, false, 0, true);

function startDragging(e:MouseEvent):void {

    e.target.startDrag();
    
    stage.addEventListener(MouseEvent.MOUSE_UP, stopDragging, false, 0, true);
    stage.addEventListener(MouseEvent.MOUSE_OUT, stopDragging, false, 0, true);
}

function stopDragging(e:MouseEvent):void {
    
    stage.removeEventListener(MouseEvent.MOUSE_UP, stopDragging);
    stage.removeEventListener(MouseEvent.MOUSE_OUT, stopDragging);
    
    e.target.stopDrag();

```

any solution?
