7 Replies Latest reply on Jul 6, 2006 11:57 PM by Newsgroup_User

    Moving movingclips and then playing them all back together

    spinz2112
      Does anyone have any sample code or pseudo code to share regarding how i can possibly be able to move 1 or more (say upto 5) movieclips one at a time, record their motion, and then replay them all together?
      I can record each movieclips motion into an array given by the movieclip name, but i have no clue how to play them all together.
      Ive been cracking my head on this for months, and have got no where. Any help would be appreciated.
      Thanks
        • 1. Re: Moving movingclips and then playing them all back together
          kglad Adobe Community Professional & MVP
          what do you mean by "...record their motion..."? and what is it that you are trying to accomplish?
          • 2. Re: Moving movingclips and then playing them all back together
            Level 7
            Hi there!

            Does this mean that you've coded the recording and you are able to playback
            one of them?

            If so, what you can do is use the onEnterFrame function for each of the
            instances (of movieclips) you want to move. Make it call some functions that
            pops off the first element in the array with the recording (for that
            instance) and perform that action. Now, this action will maybe not be done
            and over with in just one frame (depends on how you've recorded your stuff),
            so you might have to use some onDone function stuff so that when the first
            operation is done, then the onDone is triggered which pops the next
            operation off the list. If not, you'll fire off the next operation in the
            list before it is done with the first one.

            /Jensen/


            "spinz2112" <webforumsuser@macromedia.com> wrote in message
            news:e8i3rs$443$1@forums.macromedia.com...
            > Does anyone have any sample code or pseudo code to share regarding how i
            > can
            > possibly be able to move 1 or more (say upto 5) movieclips one at a time,
            > record their motion, and then replay them all together?
            > I can record each movieclips motion into an array given by the movieclip
            > name,
            > but i have no clue how to play them all together.
            > Ive been cracking my head on this for months, and have got no where. Any
            > help
            > would be appreciated.
            > Thanks
            >


            • 3. Re: Moving movingclips and then playing them all back together
              spinz2112 Level 1
              when i said 'record their motion' i meant that i am using an onEnterFrame to store the x and y coords of the mc that is being dragged into an array. each mc has its own unique array.
              i am able to store the coords of one mc, and replay it back.

              Jensen,
              I really got lost in what you are trying to explain to me. Do you have any samples pertaining to what you just explained. I couldnt really put it down to AS.
              Thanks!
              • 4. Re: Moving movingclips and then playing them all back together
                kglad Adobe Community Professional & MVP
                each movieclip should have its own array in which you'll store its _x and _y properties. if you use the same _name for each array (paths are different, so the arrays are distinct) you can pass (as a parameter) the movieclip that's being dragged and store the _x,_y properties in your current onEnterFrame handler. if you need more specific help, show your onEnterFrame handler.
                • 5. Re: Moving movingclips and then playing them all back together
                  spinz2112 Level 1
                  do the adobe forums not allow attachements? i have an fla with the initial piece, just dotn know how to upload it. any suggestions?
                  • 6. Re: Moving movingclips and then playing them all back together
                    kglad Adobe Community Professional & MVP
                    no attachments here. upload to a server and post a link.
                    • 7. Re: Moving movingclips and then playing them all back together
                      Level 7
                      Hi there!

                      Here is a code you can use. I placed 4 MCs on the stage and called them:
                      MC1, MC2, MC3 and ReplayButton
                      Then I put this code in a seperate frame

                      function recording() {
                      this.recPos.push([this._x, this._y]);
                      }

                      for (var i = 0; i < 4; i++) {
                      this["MC"+i].recPos = new Array();
                      this["MC"+i].onPress = function() {
                      this.startDrag();
                      this.onEnterFrame = recording;
                      }
                      this["MC"+i].onRelease = function() {
                      this.stopDrag();
                      delete this.onEnterFrame;
                      }
                      }

                      function replayMove() {
                      for (var i = 0; i < 4; i++) {
                      this._parent["MC"+i].index = 0;
                      this._parent["MC"+i].onEnterFrame = function() {
                      this._x = this.recPos[this.index][0];
                      this._y = this.recPos[this.index][1];
                      this.index++;
                      }
                      }
                      }

                      ReplayButton.onRelease = replayMove;


                      "spinz2112" <webforumsuser@macromedia.com> wrote in message
                      news:e8jdqe$pgm$1@forums.macromedia.com...
                      > when i said 'record their motion' i meant that i am using an onEnterFrame
                      > to
                      > store the x and y coords of the mc that is being dragged into an array.
                      > each mc
                      > has its own unique array.
                      > i am able to store the coords of one mc, and replay it back.
                      >
                      > Jensen,
                      > I really got lost in what you are trying to explain to me. Do you have any
                      > samples pertaining to what you just explained. I couldnt really put it
                      > down to
                      > AS.
                      > Thanks!
                      >