reference movieClip inside another movieClip

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phpuser123
    New Member
    • Dec 2009
    • 108

    reference movieClip inside another movieClip

    I have my general movie clip called myscene_mc .
    Inside it I've placed other 2 movie clips called man_mc and insect_mc...
    Now,my man_mc contains another movieclip which is empty and i call it forward_mc...

    Now,can I use forward_mc and insect_mc to check if they are intersecting using something like that ::

    trace(man_mc. forward_mc.hitT est(insect_mc)

    I hv tried this bt althougn they are intersecting,th e output is false

    How can I check when the 2 movie are intersecting??
    Any help will be kindly appreciated ..Thanks
  • iamfletch
    New Member
    • Jan 2010
    • 18

    #2
    i dont know what exactly your asking here. assuming you have a set up like the following:
    Code:
    var myscene_mc = new myscene_();
    var man_mc  = new man_();
    var insect_mc = new insect_();
    var forward_mc = new MovieClip();
    
    addChild(myscene_mc)
    myscene_mc.addChild(insect_mc);
    myscene_mc.addChild(man_mc);
    man_mc .addChild(forward_mc);
    then you can access them from here eg
    Code:
    //inside insect_mc
    function test (var)
    {
       trace (var)
    }
    
    // must be coded here (for the refference to insect_mc to be avalable)
    man_mc.test2 = function()
    {
       insect_mc('hi')
    }
    I havent debugged this, it should work

    Comment

    • iamfletch
      New Member
      • Jan 2010
      • 18

      #3
      ok sorry about my previous reply, i want to delete it to be honest. not many people will be able to help here as hitTest is now obsolete(its as2 and most people are as3 now). i downgraded for you and the problem has a simple solution.

      Code:
      trace(man_mc.forward_mc.hitTest(insect_mc));
      // change to 
      trace(insect_mc.hitTest(man_mc.forward_mc)

      Comment

      Working...