# \[mx\]Hittest Loop

**URL:** <https://forum.kirupa.com/t/mx-hittest-loop/26630>\
**Category:** flash\
**Created:** [July 24, 2003, 8:55pm UTC](https://forum.kirupa.com/t/mx-hittest-loop/26630 "2003-07-24T20:55:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cowien](https://avatars.discourse-cdn.com/v4/letter/c/ed655f/32.png) [@Cowien](https://forum.kirupa.com/u/Cowien)\
**Post date:** [July 24, 2003, 8:55pm UTC](https://forum.kirupa.com/t/mx-hittest-loop/26630/1 "2003-07-24T20:55:15Z")

</div>

Ok can someone post an example of a loop that uses duplicate and runs a hit test

my code does not work at ALL :-\ And Im not even sure how duplicatemovieclip works…does the new movieclip inhereit all the actionscript that the old one has? :-\

```auto

	for (x=1; x<3; x++) {
		_root.pal.duplicateMovieClip("pall"+x, x);
		for (i=1; i<3; i++) {
			if (_root.heroz.ron.hitTest(_root["pall"+i])) {
			_root["pall"+i]._visible=0
			}

```

the clip goes invisible for a single frame and then just goes back to being normal when it hits the other mc…I suck ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 25, 2003, 7:43am UTC](https://forum.kirupa.com/t/mx-hittest-loop/26630/2 "2003-07-25T07:43:34Z")

</div>

change

```auto
if (_root.heroz.ron.hitTest(_root["pall"+i])) {
			_root["pall"+i]._visible=0
			}

```

to

```auto
_root.heroz.ron.hitTest(_root["pall"+i]) ? _root["pall"+i]._visible=false : _root["pall"+i]._visible=true;

```

should work just fine 😉

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 27, 2003, 1:39am UTC](https://forum.kirupa.com/t/mx-hittest-loop/26630/3 "2003-07-27T01:39:58Z")

</div>

> \*Originally posted by fluid\_0ne \*  
> \*\*

```auto
_root.heroz.ron.hitTest(_root["pall"+i]) ? _root["pall"+i]._visible=false : _root["pall"+i]._visible=true;

```

\*\*

ok, you confused me(not like it’s hard or anything)
