10 Replies Latest reply on Aug 26, 2011 11:21 AM by Ned Murphy

    Movieclip goes back to frame 1

    James. meek

      I have created an interactivity to simulate a product.  To do this my project has multiple frames.   Each frame contains an individual movie clip.   The clips each contain buttons that change the display and go to and stop on specific frames based on which button was pressed.  My problem is, after the interaction a movie clip  may have been stopped on say  frame 12, the next time the frame containing the movieclip is opened on the main timeline I need the movieclip to open on frame 12 .  However, the movie clip opens back up at frame 1 each time not saving the interaction.

       

      Please help.

        • 1. Re: Movieclip goes back to frame 1
          Ned Murphy Adobe Community Professional & MVP

          If you do not save the status of a movieclip that you leave behind, then you need to do that by storing information somehow.  When you leave an object behind in a timeline, it is essentially no longer in your movie.  So when you return to it, it will start from where it normally starts unless you have something that saves where it was and tells it to re-assume where it was.

           

          Another approach you could consider that avoids the need to remember anything is to keep all the different animations/movieclips in the same frame and just manage their visibility instead of travelling the timeline to get to them.  That way you never leave anything behind and it will stay exactly the way you left it.

          1 person found this helpful
          • 2. Re: Movieclip goes back to frame 1
            James. meek Level 1

            how can i save the status of the clip that I left behind?

             

            I did think about multiple frames instead of movie clips with visiblity but was hoping to avoid that.  I like the go to next frame and stop concept.  The visiblity idea I think would create a lot more coding with the make this visible and make this not visible to include new buttons for each instance.  Right now I have around 70 frames each with a clip.  Each clip contains between 5-100 frames.

            • 3. Re: Movieclip goes back to frame 1
              Ned Murphy Adobe Community Professional & MVP

              You'd probably have less code going with movieclips/visibility, especially since you otherwise need to add code for each frame to remember and process where each movieclip was left.  With the visibility approach you can have one function that sets all movieclips invisible at once, which saves alot, especially if you name them in a manner that supports looping thru them easily.

               

              To do it the frame route, you will need to have one actions layer that in frame 1 contains variables for each movieclip along the timeline for which you need to retain information about.  This layer needs to extend the full length of the timeline so that you never lose whatever information these variables hold.

               

              When you process one of the movieclips you need to continuously update its variable with whatever status you know it needs to have, such as what frame it is in and what certain variable statuses within it have been set to.  If you know they need to know more than just which frame they were left, then you need to use objects as the variables, or some other data structure that allows for storing multiple pieces of information.

               

              Anytime you go to a frame you need to use that frame's variable to set up the movieclip that lives there.

              1 person found this helpful
              • 4. Re: Movieclip goes back to frame 1
                James. meek Level 1

                Thanks Ned

                 

                I hate it but i think Im going to redo the whole thing and keep the main time line one frame with visible/not visible to switch between each main movie clip.

                Please verify that if I do this making the clip go from visible to not visible then back to visible. It will bring the movieclip back visible on the last frame viewed.

                • 5. Re: Movieclip goes back to frame 1
                  Ned Murphy Adobe Community Professional & MVP

                  You can verify it yourself with a simple test using a movieclip from your current design.

                   

                  I would bet that you'd hate even more doing all of what you needed to do if you went the way you wanted to go.  There are different reasons for different design approaches, and from what you described the parallel existence approach is the better choice.

                  • 6. Re: Movieclip goes back to frame 1
                    Lon Winters Level 4

                    I would agree that the visibility option is pro ably the better option, but I don't think the variable option would be that difficult either. But it would depend on how many movie clips there are. If there were like 100, then to me that would be prohibitive with all the coding needed and all the variables that would be needed. Plus, if only the frame needed to be saved, then the variable could be updated on each frame using the same code using the current frame. All you would need others is a gotoAndStop to that variable.

                    • 7. Re: Movieclip goes back to frame 1
                      Ned Murphy Adobe Community Professional & MVP

                      It was already mentioned that there are currently 70 frames/movieclips and I believe growing.  And even at much fewer than that I would still recommend the visibility approach.  Going the frame route requires building additional code into each movieclip to save to the variables in the parent timeline that also need to be coded in the main timeline, as well as the code in each frame to set up each movieclip when you get there.  Calling one function that sets everybody invisible before setting the one requested movieclip visible is significantly less coding regardless of how many movieclips are involved.

                      • 8. Re: Movieclip goes back to frame 1
                        James. meek Level 1

                        Thanks again the visible/ not visible does work just going to be alot work to get it all together.  But hey the boss guy loves it.

                        • 9. Re: Movieclip goes back to frame 1
                          Lon Winters Level 4

                          I must have mis-read as I took the 70 frames reference to be how many frames there were in each movie clip. And along the same lines as my previous post, I don't think that implementing the visibility approach will require as much work as the OP is anticipating.  Maybe I'm being overly optimistic, nut it's been my experience that when you're working on a particular solution, especially if there are relative steps involved, the first few times is figuring out the code and the best workflow, then the rest goes much quicker.

                          • 10. Re: Movieclip goes back to frame 1
                            Ned Murphy Adobe Community Professional & MVP

                            You're welcome.