# duplicateMovieClip & hitTest problem!

**URL:** <https://forum.kirupa.com/t/duplicatemovieclip-hittest-problem/235430>\
**Category:** Uncategorized\
**Created:** [August 10, 2007, 9:42pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-hittest-problem/235430 "2007-08-10T21:42:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![flycom](https://avatars.discourse-cdn.com/v4/letter/f/898d66/32.png) [@flycom](https://forum.kirupa.com/u/flycom)\
**Post date:** [August 10, 2007, 9:42pm UTC](https://forum.kirupa.com/t/duplicatemovieclip-hittest-problem/235430/1 "2007-08-10T21:42:38Z")

</div>

Hello @ll;

I have problem with hitTesting duplicating movieClips.

What I am trying to do is duplicate MC(item) in random position \_x & \_y of the stage.  
Problem is when they touch each other. How can I check if they are not touching each other and if so - move to position where they are not touching.

Here is the code so far:

```php

_global.arrTitle = new Array ("value1", "value2", "value3", "value4", "value5", "value6", "value7", "value8");

total = arrTitle.length;
trace("total: "+total);

function randRange(min:Number, max:Number):Number {
    var randomNum:Number = Math.floor(Math.random() * (max - min + 1)) + min;
    return randomNum;
}
var dwidth:Number = Stage.width-100;
    trace("teritory width: "+dwidth);
    
var dheight:Number = Stage.height-100;
    trace("teritory height: "+dheight);

for (a=0; a<total; a++) {

mc = duplicateMovieClip("item", "item"+a, a+1);

    //--------------------------------------//    
    var w:Number = randRange(0, dwidth)
    trace("w: "+w);
    
    var h:Number = randRange(0, dheight);
    trace("h: "+h);
    //-------------------------------------//

eval("item"+a)._x = w
eval("item"+a)._y = h
item._visible = false;
}

```

Many Thanks for HELP!!
