A Flash Developer Resource Site

Results 1 to 5 of 5

Thread: hittest with nested movieclips

  1. #1
    Junior Member
    Join Date
    Oct 2008
    Posts
    19

    hittest with nested movieclips

    I have a lot of nested movie clips. For some reason someone at one point told me it was a good idea.

    I can't seem to get hittest to work. Any help is appreciated... Can you even hittest movies clips inside different movie clips?

    This is my code:
    Code:
    for(var x=0;x<=5000; x++){
    		if(this.hitTest(_root.jet, _root.environment_mc.environment.bombSpawn_mc.flying_mc.bigBomb_mc)) {
              trace("Collision Detected");
        } else {
              trace("No Collision");
        }
    };

  2. #2
    Junior Member
    Join Date
    Oct 2008
    Posts
    19
    I tried putting the hittest code in the flying_mc movieclip and that doesn't work either...

    Code:
    		if(this.hitTest(_root.jet, this.bigBomb_mc)) {
              trace("Collision Detected");
        } else {
              trace("No Collision");
        }

    Why doesn't this work?

  3. #3
    Junior Member
    Join Date
    Oct 2008
    Posts
    19
    Here, this one should be easy for anyone thats worked with hittest before. I made the file really really simple. I am trying to hit test the jet and flying_mc.

    This is how I am writing it:

    Code:
    this.onEnterFrame=function(){
    		
    		if(this.jet,hitTest(_root.flying_mc)) {
              trace("Collision Detected");
        } else {
              trace("No Collision");
        }
    }

    Please help

  4. #4
    Junior Member
    Join Date
    Oct 2008
    Posts
    19
    I'm getting somewhere... I know have this:


    Code:
    onClipEvent (enterFrame) {
    		
    	if (hitTest(_root.flying_mc.bigBomb_mc)) {
              trace("Collision Detected");
    	} else {
              trace("No Collision");
    	}
    }
    That is on the jet movieclip. It works but only on the original bomb that the other ones spawn from. How do I hittest the duplicates?

  5. #5
    Junior Member
    Join Date
    Oct 2008
    Posts
    19
    Found this recent thread:

    http://board.flashkit.com/board/showthread.php?t=688580

    I don't understand the arrays though. I'm new. Could someone please explain?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center