3 Replies Latest reply on Jan 15, 2008 11:07 AM by Newsgroup_User

    Movie Clip Heiarchy Help!

    klocascio
      I have a timeline where each frame has a different movieclip. each of these movieclips have 5 specific frames inside them. I can jump between frames on the main timeline by doing this;

      this._parent.gotoAndStop(2); this brings me to the first frame of the movie clip.

      but if i want to do the same thing but go direcly to the 5th frame in said movieclip what do I do?
        • 1. Re: Movie Clip Heiarchy Help!
          Level 7
          klocascio,

          > I have a timeline where each frame has a different movieclip.
          > each of these movieclips have 5 specific frames inside them.

          I'm with ya so far.

          > I can jump between frames on the main timeline by doing this;
          >
          > this._parent.gotoAndStop(2); this brings me to the first frame
          > of the movie clip.

          That part confuses me. Where is that line of ActionScript? If the code
          appears in a keyframe of the main timeline itself -- and if you wanted to
          move the main timeline's playhead -- you could use this:

          this.gotoAndStop(frame number here);

          That fact that you're prefixing the MovieClip.gotoAndStop() method this
          this._parent means your code must be inside a keyframe of the first of your
          movie clips. But I'm not sure how gotoAndStop(2) would take you to the
          first frame. Second frame, yes.

          > but if i want to do the same thing but go direcly to the 5th frame
          > in said movieclip what do I do?

          The frame you want to jump to is determined by the number you feed in as
          a parameter. gotoAndStop(5) takes you to frame 5. The question of *which*
          timeline should be jumped around depends on a) your object reference (e.g.
          this, or this._parent, or an instance name) and b) the location of the code
          making the reference.


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."


          • 2. Movie Clip Heiarchy Help!
            clbeech Level 3
            well your going to run into some difficulty here. the reason will be that, you cannot call to a movieclip (MC) that doesn't exist in the current location of the playhead, even though it's IN the file, it's not 'instantiated' at the time of the call, UNLESS you're are currently on the frame that it resides. so if your calling to advance the timeline of one of the other clips you will need to first send the playhead to the frame where the clip resides, then make a call to goto to the frame in the clip. you will need to also set a variable to do so for each call. so for each call to a frame on the main timeline first you would set the 'page' (lets say) variable, then on each frame of the main timeline, you would also then use that variable to navigate to a frame in the clip on that frame. so you would say:

            this._parent.page=5;
            this._parent.gotoAndStop(2);

            and in the actions layer on frame two (and all frames) you would have the statement:

            the_mcName.gotoAndStop(page);

            'the_mcName' should be the instance name of the MC on that frame.

            EDIT- lol - sorry David hadn't seen you post here :)
            • 3. Re: Movie Clip Heiarchy Help!
              Level 7
              clbeech,

              Aha! I'll bet you nailed it. I think I missed the OP's intention
              altogether.


              David Stiller
              Adobe Community Expert
              Dev blog, http://www.quip.net/blog/
              "Luck is the residue of good design."