# HitTest detect random duplicated instance

**URL:** <https://forum.kirupa.com/t/hittest-detect-random-duplicated-instance/163738>\
**Category:** flash\
**Created:** [September 25, 2005, 8:40pm UTC](https://forum.kirupa.com/t/hittest-detect-random-duplicated-instance/163738 "2005-09-25T20:40:23Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![antijorge](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/antijorge/32/1766_2.png) [@antijorge](https://forum.kirupa.com/u/antijorge)\
**Post date:** [September 25, 2005, 8:40pm UTC](https://forum.kirupa.com/t/hittest-detect-random-duplicated-instance/163738/1 "2005-09-25T20:40:23Z")

</div>

I’ve got this code on my frame:

if (\_root.count \<= 20) {  
duplicateMovieClip("\_root.clip", “clip”+\_root.count, \_root.count);  
\_root[“clip”+\_root.count].\_x = random(500)+50;  
\_root[“clip”+\_root.count].\_y = random(1)+20;  
}

And I need to figure out how to have the hitTest see the randomly generated instances of this duplicated mc.

I can get the hitTest to see the first instance (called “clip”), but then it doesn’t see all the rest.

Here’s the code I have on the hitTestMC:

onClipEvent (enterFrame) {  
if (\_root.chime1, hitTest(\_root.clip)) {  
\_root.chime1.gotoAndPlay(“play1”);  
}  
}

thanks for looking
