5 Replies Latest reply on Nov 10, 2010 10:07 AM by Man213Ba213rt123

    hide a movie clip

    Man213Ba213rt123 Level 1

      Hello. I have some code for my movie clip which is as follows:

       

      purplebow.onRelease=function(){

      purplebow.onEnterFrame=function(){

      this.nextFrame();

      if(this._currentframe==this._totalframes){

      delete this.onEnterFrame;

      }

      }

      }

       

      purplebow.onRollOut=function(){

      purplebow.onEnterFrame=function(){

      this.prevFrame();

      if(this._currentframe==1){

      delete this.onEnterFrame;

      }

      }

      }

       

      When you click on the movieClip "purplebow" the animation starts, and when you roll off it goes back to normal.

      What I would like help on is implementing some code into this so that my other movieClips (which are: bluebow, redbow, greenbow, etc)

      disappear onRelease and then return onRollOut.

      The code and the movieClips are all on the same timeline, each on different layers.

       

      Thank you for your help in advance =)

        • 1. Re: hide a movie clip
          Ned Murphy Adobe Community Professional & MVP

          One way would be to create a function that you use to make all the objects invisible and call that function.  Then after that function call, set the clicked one back to being visible (I am assuming you want to have the same effect for the other buttons, otherwise no need to involve purplebow at all).  Later on with the rollout you can call a function to make them all visible again.

           

          Normally I would use the same function and pass it an argument as to whether to make things visible or invisible.  something like...

           

          function show_hide(truefalse){

               bluebow._visible = truefalse;

               etc...

          }

          • 2. Re: hide a movie clip
            Man213Ba213rt123 Level 1

            Hi, thanks for your swift reply.

            How exactly would you implement that into my code.

            I don't want it to be a standalone function . I only want the bluebow, greenbow etc to disappear when I click the purplebow.

            (then ill duplicate the code to work so when i click the bluebow, the greenbow and purplebow disappear you see)

             

            Thanks

            • 3. Re: hide a movie clip
              Ned Murphy Adobe Community Professional & MVP

              That's an unecessary waste of code.  If you want to do it your way then just add the lines of code to make each invisible/visible into the code you showed.  You control visibility by setting the _visible property of an object to be either true or false.

              1 person found this helpful
              • 4. Re: hide a movie clip
                Man213Ba213rt123 Level 1

                right got ya! Thanks for your help again!! =)

                • 5. Re: hide a movie clip
                  Ned Murphy Adobe Community Professional & MVP

                  You're welcome

                  1 person found this helpful