# hitTest fails after loadMovie

**URL:** <https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756>\
**Category:** flash\
**Created:** [August 3, 2004, 4:05pm UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756 "2004-08-03T16:05:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ageren](https://avatars.discourse-cdn.com/v4/letter/a/82dd89/32.png) [@Ageren](https://forum.kirupa.com/u/Ageren)\
**Post date:** [August 3, 2004, 4:05pm UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/1 "2004-08-03T16:05:09Z")

</div>

Hi people,

- I have a movie which checks for a hitTest between a red ball and a blue  
square. If I trace it, it says TRUE
- if I load this movie in a main swf with loadMovie(“game.swf”,gameMC), the  
trace says FALSE!

the gameMC is at x=50 and y=50. If I put it at x=0, y=0… it works!

So, there must be something with x- and y-coordinates. I cannot figure out  
after 2 full days what is wrong!

I’ve checked:

- I do not use any \_root or references in the game.swf
- I traced the \_x and \_y of the ball and the square, they give same results  
in both cases!

PLEASE HELP ME!  
🙂

Kind regards

---

<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:** [August 4, 2004, 6:51am UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/2 "2004-08-04T06:51:13Z")

</div>

Post your fla(s)?

scotty(-:

---

<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:** [August 5, 2004, 9:11am UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/3 "2004-08-05T09:11:15Z")

</div>

Ok, I’ve posted the fla’s. stripped down to very basic, 1 frame each.

the main movie: [www.formedia.nl/hittest/game.fla](http://www.formedia.nl/hittest/game.fla)  
the movie to load: [www.formedia.nl/hittest/test.fla](http://www.formedia.nl/hittest/test.fla)

And still looking for answer 🙂

---

<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:** [August 5, 2004, 9:35am UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/4 "2004-08-05T09:35:59Z")

</div>

Works fine here:)  
You’re aware that you check the hitTest between the ball **mc** and the square **x/y coordinates**?

scotty(-:

---

<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:** [August 5, 2004, 10:22am UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/5 "2004-08-05T10:22:36Z")

</div>

> [@scotty](#):
>
> Works fine here:)  
> You’re aware that you check the hitTest between the ball **mc** and the square **x/y coordinates**?  
> scotty(-:

It gives true when you check it in the original movie, and when loading it in the main movie? How can that be, do you have another Flash MX?

I’m aware of the x/y coordinates, it requires that in my movie. If it works in the movie itself, it should work in the main movie, I think 🙂 But I will try to find another way to solve it then

---

<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:** [August 5, 2004, 11:58am UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/6 "2004-08-05T11:58:28Z")

</div>

Maybe I’m getting you wrong, but have a look at my example;)

scotty(-:

---

<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:** [August 5, 2004, 12:52pm UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/7 "2004-08-05T12:52:30Z")

</div>

> [@scotty](#):
>
> Maybe I’m getting you wrong, but have a look at my example;)
> 
> scotty(-:

Yes. Do you notice how they are not the same?  
situation 1: game.swf loaded in main movie  
situation 2: game.swf

In your fla’s : situation 1 gives the Been Hit signal much later than in situation 2.  
It becomes more clear when you put the blue ball over the red square and trace it in both movies. One says: been hit, the other not hit.

Do you see the difference?

---

<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:** [August 5, 2004, 1:49pm UTC](https://forum.kirupa.com/t/hittest-fails-after-loadmovie/59756/8 "2004-08-05T13:49:33Z")

</div>

You’re right 😊  
If you look in AS dictionary

> Availability Flash Player 5.

Usage

my\_mc.hitTest(x:Number, y:Number, shapeFlag:Boolean) : Boolean  
my\_mc.hitTest(target:Object) : Boolean

Parameters

x_The x coordinate of the hit area on the Stage.  
y_The y coordinate of the hit area on the Stage.

The x and y coordinates are defined in the global coordinate space

I think the last line is what’s making it go wrong.  
I guess you have to look for localToGlobal or globalToLocal, but I never got those two working properly [size=1](But that says more about me then about those functions, LOL)[/size]

scotty(-:
