# Problem in Duplicating Movieclips and using hitTest

**URL:** <https://forum.kirupa.com/t/problem-in-duplicating-movieclips-and-using-hittest/154347>\
**Category:** flash\
**Created:** [July 8, 2005, 6:41pm UTC](https://forum.kirupa.com/t/problem-in-duplicating-movieclips-and-using-hittest/154347 "2005-07-08T18:41:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![YoungNastyMan](https://avatars.discourse-cdn.com/v4/letter/y/a6a055/32.png) [@YoungNastyMan](https://forum.kirupa.com/u/YoungNastyMan)\
**Post date:** [July 8, 2005, 6:41pm UTC](https://forum.kirupa.com/t/problem-in-duplicating-movieclips-and-using-hittest/154347/1 "2005-07-08T18:41:04Z")

</div>

Hello,  
I’m trying to make a dodgeball-style of game using Flash Mx 2004, and I’m having difficulty in duplicating my ball movieclips and getting my hitTest to work with each ball.  
Basically, I created a cursor movieclip called cursor\_mc that is dragged by moving the mouse around. This part works fine, but the trouble occurs in trying to recognize when cursor\_mc hits each ball\_mc. I’m using a code to duplicate the ball\_mc 4 times and they move in random directions and speeds. So far, I can only get the hitTest to work on the original ball\_mc from which the other 4 ball\_mc’s are duplicated.

I’ve tried the following codes:

in the actions frame:

```
 onEnterFrame = function () {
        if (ball_mc.hitTest(cursor_mc)) {
            trace ("ouch");
             }
 }

```

The previous code only allows the hitTest to work on the original ball\_mc. Next, I tried the following two codes with no results:

on the ball\_mc:

```
 onClipEvent (enterFrame) {
        if (this.hitTest(cursor_mc)) {
            trace ("ouch");
             }
 }

```

and on the the cursor\_mc:

```
 onClipEvent (enterFrame) {
        if (this.hitTest(ball_mc)) {
            trace ("ouch");
             }
 }

```

Note: These codes weren’t used at the same time, but I was experimenting with each one individually.

Any suggestions?
