# Working with hitTest

**URL:** <https://forum.kirupa.com/t/working-with-hittest/201799>\
**Category:** Uncategorized\
**Created:** [September 25, 2006, 9:50am UTC](https://forum.kirupa.com/t/working-with-hittest/201799 "2006-09-25T09:50:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lacus](https://avatars.discourse-cdn.com/v4/letter/l/a9a28c/32.png) [@Lacus](https://forum.kirupa.com/u/Lacus)\
**Post date:** [September 25, 2006, 9:50am UTC](https://forum.kirupa.com/t/working-with-hittest/201799/1 "2006-09-25T09:50:41Z")

</div>

Hi,  
I am suppose to duplicate movie clip, attachMovie and set position it.  
I have done it with the following codes below:

```auto

myobject.onMouseDown = function()
{
  if (empty1.hitTest(_xmouse,_ymouse,false))
  {
     numOfChars = numOfChars + 1;
     empty1.duplicateMovieClip("setChar"+numOfChars,numOfChars);
     
     attachMovie("char1","setChar"+numOfChars,numOfChars);
     setProperty ("setChar"+numOfChars,_x, "100");
     setProperty ("setChar"+numOfChars,_y, "100");
     setCharacters.push("setChar" + numOfChars);
  }
}

```

I managed to do so and push the name to the array.

However, when i tried to code it so i’m able to drag it around,  
I am unable to do so with the following coding:

```auto

 var i = 0;
 if(setCharacters.length > i){
   trace(setCharacters*);
   if (_level0.(setCharacters*).hitTest(_xmouse,_ymouse,false))
   {
    startDrag(_root.setCharacters*);
    i++;
   }
 }

```

Can anyone please help me? Thanks \>.\<
