[Flash MX2004] MC + hitTest Q's - plz help


I’ve just a few questions to ask as im havin problems solving what should b a fairly simple task.

Is there any way to hitTest a MC that is on the main stage with another MC from the library? i want to have multiple instances of the same object but dont want to go around labeling every instance with the same name, and applying the hitTest function to every instance of this MC wouldb’t be wise.

I have a MC inside an other MC that i am trying to hitTest with a single moveable MC on the main stage. The code i am currently using is:

onClipEvent(enterFrame) {
     if(this.hitTest(_root.bottom.sides)) {
          this._x -= 10;

I have 2 MC’s within the “bottom” MC both labeled “sides” but when i run the **** thing it doesnt work. ive checked the syntax, instance names, the actual positions of the MC’s (to make sure the _root path is correct) and changed “this.hitTest” to “_root.player.hitTest” but still the bloody thing perplexes me.

After hours of careful consideration i decided to turn to the forums in hope of a useful tutorial or thread i could read but still, i am clueless.

Can anyone see any problems with the code? if u need more info ill upload the .fla so y’all can see.

Thanks 4 reading :slight_smile:

I had a little project where I wanted to do the same thing you are attempting. I couldn’t get it to work either. I thought there might be something to do with the “localToGlobal” command, but I still had no success. I then re-coded everything to work from the root, which sucks. I’ve since abandoned my original idea and moved on to another angle. But still…

If anyone can shed some light on this hitTest business, let us know! :slight_smile:

try renaming once of the ‘sides’ to ‘side1’ and see what happens, there may be some complication with duplicate mc names.

Other than that, it looks spot-on.

I havent had time yet to try renaming the duplicate MC’s but i will have a go as soon as i get back to working on it again, although i was hoping for an easier method than having to code every single instance ofthe MC into the hitTest, almost not worth bothering really.

If anyone else can think of any ideas i’d b more than happy to listen?

Im sure ive seen something similar used elsewhere, an inventory tutorial for a flash game i think :sure: cant remember tho?!? will hav to try hunt that one down.

thanks for reading + the replies - much appreciated :slight_smile: