3 Replies Latest reply on Jun 8, 2011 5:45 PM by Ned Murphy

    movieclip function affecting clips on other frames

    learner102

      I once again need to cheat and ask for action script 2 help.  The idea is to click on a mc that takes you back one frame (into a different room) and it changes the visibilty of another mc in the new room to false.  Here is the code so far:

       

      poodle_mc.onPress=function(){
      _root.rooms_mc.safeClosed_mc._visible=false;
      _root.rooms_mc.gotoAndStop("Office");
      }

       

      I return to the "Office" frame just fine but the safeClosed_mc is still visible.  Help please.  Thank you.

        • 1. Re: movieclip function affecting clips on other frames
          Ned Murphy Adobe Community Professional & MVP

          If that mc isn't in the frame where that code executes, then you cannot affect it.  What you would need to do is either have that mc also in the frame where the code is, or you need to set a global variable to a true/false value as needed and use it when you get to the frame where that mc is.... meaning your button code would set a variable like...  mcVisible = false;   and in the frame you get to you would have something like... mc._visible = mcVisible;

          1 person found this helpful
          • 2. Re: movieclip function affecting clips on other frames
            learner102 Level 1

            Thank you, Ned.  I found a (not perfect) work around to the problem with snipets of helpful code you have given me previously.  But now I am left with another big issue.  I have hidden mc's that react to hitTests when i do not want them to.  Obviously later in my game when they become visible do i want them to react to my inventory mc hitTests. I hope you can help me again with some good advise.  Thanks.

            • 3. Re: movieclip function affecting clips on other frames
              Ned Murphy Adobe Community Professional & MVP

              You may need to introduce some other logic to refrain from taking action on them.  Even though they are invisible, they are still around and a hitTest for them will find them.  So you might have to either keep them out of the stage until they are needed or include a test of their visibility in your logic...

               

              if(mc._visible && inventoryMC.hitTest(mc))....

              1 person found this helpful