8 Replies Latest reply on Jun 11, 2009 5:09 PM by Ned Murphy

    Nested MovieClips

    GumpsterF Level 1

      I have a problem that I think is a simple one but I cannot seem to figure it out, and it has been 2 days of fighting wiht it so I am here to plea for help from the collective experts. Here is the issue.

       

      I have created a movieClip which is just a rectangle shape that has an interior timeline which object tweens from a 2x200 pixel to a 200x200 pixel shape.

      This movieClip has an instance name of menu_2.

       

      After the tween happens inside menu_2, on the stop(); frame I have placed another movieClip with an instance name of mi_1. This clip is 100 x 35 pixels and site floating inside the menu_2 MovieClip. Inside this movieClip there is a timeline where there are a "the_start" and a "the_end" label on either end of the timeline each with stop(); comands and some graphics which change opacity.

       

      What I cannot seem to get to happen is to activate the timeline inside the mi_1 MovieClip. What I would like to happen is that when the user mouses over the mi_1 movieClip, it triggers a number of events, along with triggering playing the timeline inside of mi_2.

       

      Here is the code I have tried on the main (scene 1) timeline. None of which have worked.

       

       

      menu_2.mi_1.onRollOver = function() {
           menu_2.mi_1.gotoAndStop("the_end");
      };
      
      mi_1.onRollOver = function() {
           mi_1.gotoAndStop("the_end");
      };
      
      menu_2.onRollOver = function() {
           mi_1.gotoAndStop("the_end");
      };
      
      menu_2.onRollOver = function() { 
      this. mi_1.play(); 
      };
      
       
      

       

      Here is the code I have tried inside the menu_2 MovieClip on the same frame as the mi_1 has been placed;

       

       

      this.onRollOver = function() {
           mi_1.gotoAndStop("the_end");
      };
      
      mi_1.onRollOver = function() {
           gotoAndStop("the_end");
      };
      
      this.onRollOver = function() {
           this.gotoAndStop("the_end");
      };
      

       

      Nothing seems to be working.

      I'll send anyone the FLA willing to help...

      Help!

      Forrest

        • 1. Re: Nested MovieClips
          Ned Murphy Adobe Community Professional & MVP

          If mi_1 lives down the timeline on menu_2, the code that you have on the main timeline cannot communicate with it because it doesn't exist when that code executes.  Try moving the mi_1 code down to the stop frame inside menu_2.

           

          Another option would be to have mi_1 invisible up until that stop frame, and at the stop frame make it visible.  That way, it would be site of the main timeline code.

          • 2. Re: Nested MovieClips
            GumpsterF Level 1

            Hi Ned.

             

            I have tried option 1, with no luck. Maybe I had the wrong code? I posted three different code attempts for your option 1 in my original post.

             

            If I am to try option 2 that you suggest, I think I understand how to make the mc invisible, mi_1.visible = false; ?

             

            What would be the correct code on the mail timeline to trigger events inside mi_1?

             

            Ned, may I send you this FLA, just to look at not to fix for me?

             

            Forrest

            • 3. Re: Nested MovieClips
              Ned Murphy Adobe Community Professional & MVP

              In the first frame inside the menu_2 movieclip you would have:

               

              mi_1._visible = false;

               

              and mi_1 would need to extend all the way back to frame 1

               

              When you get to the point where it would appear, you would use

               

              mi_1._visible = true;

              • 4. Re: Nested MovieClips
                GumpsterF Level 1

                Fair enough, I understand that, but then how do I get (and what code do I use) to execute the timeline inside of the mi_1 mc using a onRollOver command on the main timeline?

                • 5. Re: Nested MovieClips
                  Ned Murphy Adobe Community Professional & MVP

                  The first one shown should do the trick if what I understand the scenario to be is correct:

                   

                  menu_2.mi_1.onRollOver = function() {
                       menu_2.mi_1.gotoAndStop("the_end");
                  }

                  • 6. Re: Nested MovieClips
                    GumpsterF Level 1

                    That's what I thought too Ned. All the reseach I did, tells me that is how you access a nested movieClip in another MovieClip.

                    Your visible code works as it should, but I still cannot get the nested MovieClip to be affected by a call to action on the main timeline.

                     

                     

                    menu_2.mi_1.onRollOver = function() {

                         menu_2.mi_1.gotoAndStop("the_end");

                    };

                     

                     

                    Did not do anything. I would have just used a button with roll over effects, but a button also seems to be masked inside the menu_2 mc.

                     

                    aarrrg.

                    • 7. Re: Nested MovieClips
                      GumpsterF Level 1

                      On second inspection Ned, your advice was spot on. I made a new Movie, very simple and it works fine.

                      I think my problem was when the menu_2 m appeared on the stage as opposed to when the code appeared.

                      I just need to simplify my movie I think and start again.

                       

                      Thanks for the help and making me think about it.

                       

                      Cheers

                       

                      Forrest

                      • 8. Re: Nested MovieClips
                        Ned Murphy Adobe Community Professional & MVP

                        You're welcome Forrest.  That's a key thing to remember, though it's easy to overlook at times... things have to be in the presence of code that is talking to them.