# A basic understanding problem path and function

**URL:** <https://forum.kirupa.com/t/a-basic-understanding-problem-path-and-function/215590>\
**Category:** Uncategorized\
**Created:** [February 8, 2007, 2:15pm UTC](https://forum.kirupa.com/t/a-basic-understanding-problem-path-and-function/215590 "2007-02-08T14:15:13Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![sivant](https://avatars.discourse-cdn.com/v4/letter/s/cc9497/32.png) [@sivant](https://forum.kirupa.com/u/sivant)\
**Post date:** [February 8, 2007, 2:15pm UTC](https://forum.kirupa.com/t/a-basic-understanding-problem-path-and-function/215590/1 "2007-02-08T14:15:13Z")

</div>

i wrote a function that attaches a MC that is dragged and tests a hittest for a new location. and it almost works the way i want.but can any bodey explain to me why  
only **\_root.mouseDown** works and **targetClipbtn.mouseDown** doesnt?  
and why when i add the second part of the code **\_root.onMouseUp** nothing works?  
(i put all the code…)

```auto

function rope() {
 //creating and attaching an mc(ropeBtn) to it in order to drag it 
 this.createEmptyMovieClip("targetClipbtn", 1);
 this.targetClipbtn._x = 143.45;
 this.targetClipbtn._y = 83.5;
 this.targetClipbtn.attachMovie("ropeBtn", "ropeBtn11", 1);
 //finding th x and y of the mouse and compareing it to my MC with(hitTest)and start dragging
 _root.onMouseDown = function() {
  mxx = _xmouse;
  my = _ymouse;
  if (this.targetClipbtn.hitTest(mxx, my, true)) {
   this.targetClipbtn.startDrag();
   //comparing with the new location
   onMouseMove = function () {
    if (this.targetClipbtn.hitTest(243, 127.25, true)) {
     this.targetClipbtn.removeMovieClip();
    }
   };
  }
 };
}
rope();
 

```

```auto

_root.onMouseUp = function():Void {
 delete (_root.onMouseDown);
 delete (_root.onMouseMove);
 updateAfterEvent();
};
 

```
