6 Replies Latest reply on Feb 27, 2009 10:49 AM by Ned Murphy

    Problems going to a 2nd scene

      I have 2 scenes. In the first scene MCs are created by attachMovieClip.
      On pushing a button the second scene is called by gotoandPlay (scene,frame).
      So long it works very well. But now my problem:
      With the second scene all my attached MCs from the first scene are visible.
      That was surprising for me.
      How could I avoid that or is there a simple workaround?
        • 1. Re: Problems going to a 2nd scene
          Ned Murphy Adobe Community Professional & MVP
          Attach them into containers in the first scene (empty movieclips), but not dynamically created ones. Things that are added dynamically without an anchoring container (like an mc) don't have a home on the timeline. They exist anywhere/everywhere.
          • 2. Re: Problems going to a 2nd scene
            Level 7
            In addition to what NedWebs said, when compiled scenes are turned into
            frames - so when you change scenes you're really just going to frame 30(or
            whatever) of the main timeline which has your attached clip in it. You can
            do as he suggested and use container clips, or simply removeMovieClip() on
            them before going elsewhere.

            Dave -
            Adobe Community Expert

            • 3. Re: Problems going to a 2nd scene
              wbpit Level 1
              Many thanks for your answers.
              Of course the situation is very sad. I thought, that a scene is a very closed system (as it is on a stage). So, I have to think over my further projects.
              In my case, removeMC is not really applicable, because after returning to scene 1, I need the previous dynamically created MCs again.
              My idea was, to make them invisible before, but then I need a function or something like that, to make them visible again.
              As a second trial I would use the (static) container idea.
              In my case I think it would work, because I have defined number of dynamically created MCs. But what's about it, if there is an undefined number of dynamically MCs?
              Is that the only way to get to my goal?
              • 4. Re: Problems going to a 2nd scene
                Ned Murphy Adobe Community Professional & MVP
                If there is an undefined number of dynamically created mc's then you can still take the same approach, load them all into the same empty movieclip and locate them as needed. If you place the empty movieclip in the upper left corner of the main stage, you can place dynamic mc's in it and locate them using the same placement (x/y) values as you would had they been placed directly on the stage.
                • 5. Re: Problems going to a 2nd scene
                  wbpit Level 1
                  Thanks to your help it's working so far. But now I encountered further difficulties, which now came up.
                  In scene1 I have some dynamic text and component-buttons. Context depending text is written to text field and
                  some buttons are made invisible.
                  But now i am wondering again: After returning from scene2 back to scene 1 all the properties of the buttons and the text seems to be forgotten. It looks like a redraw of the window is missing.
                  All the texts show the initial value and all previous invisible buttons are now visible.
                  I didn't find a "redraw"-Method or something like that (I thought, it's done automatically by Flash??).
                  Changing a scene is that a "one way" direction? Was it not foreseen to go back to a scene?
                  Thanks in advance for your answer?
                  • 6. Problems going to a 2nd scene
                    Ned Murphy Adobe Community Professional & MVP
                    Moving anywhere is a one way deal. If you don't take measures to remember the states of things in frames that you leave behind, they will set up to what they were originally when you return.

                    I guess it hasn't been mentioned yet, but scenes are not a recommended design choice.

                    If you are willing to, take your scenes and convert them into movielcips and place them in just the one scene. And place them in the same column on different layers. Give them instance names and set their visibility such that it starts with the first "scene" being visible and the second one not. So your entire file will exist inthe first frame of the main timeline... two movieclips on different layers.

                    When you go to the second "scene" (making it visible and making the first invisible) you are guaranteed to have the first scene return the way you left it when you switch visibilities back again.