3 Replies Latest reply on Apr 28, 2008 8:10 AM by kglad

    How to tell who is on the Stage?

    Level 7
      How can I tell which movie currently is on the Stage, to be able to remove
      it?

      For example, I have 3 buttons on the stage:

      button "Banana"
      button "Apple"
      button "Orange"

      When I press "Apple", the movie clip "ApplePie" is attached to the movie
      container on the stage:

      _root.Banana.onRelease = function(){
      _root.MovieContainer.attachMovie("ApplePie","ApplePie",1, {_x:0, _y:0});
      }

      Now, if I press Orange, I want to remove previous movie clip from the stage
      and attach new - "OrangePie".

      But how can I know what movie clip is currently on, to be able to remove it?
      I may have 50 buttons, and I can't know which of them was pressed
      previously..

      Any ideas?

      Thanks in advance,
      B.

        • 1. Re: How to tell who is on the Stage?
          robdillon Most Valuable Participant
          You can create a variable to hold the name of the currently loaded movie.
          If you only need one movie on the stage at any time, then just have one movieClip on the stage that you load the others into.

          If as in your example code, everything is loaded into a clip named MovieContainer, then you don't need to unload the current movie. Loading a new movie into the same movieClip will remove the current movie by default.
          • 2. Re: How to tell who is on the Stage?
            Level 7
            Thanks :)
            I didn't know that loading another movie would remove previously loaded..



            "Rob Dillon" <rob@ddg-designs.com> wrote in message
            news:fv4gou$bi3$1@forums.macromedia.com...
            > You can create a variable to hold the name of the currently loaded movie.
            > If you only need one movie on the stage at any time, then just have one
            > movieClip on the stage that you load the others into.
            >
            > If as in your example code, everything is loaded into a clip named
            > MovieContainer, then you don't need to unload the current movie. Loading a
            > new
            > movie into the same movieClip will remove the current movie by default.
            >

            • 3. Re: How to tell who is on the Stage?
              kglad Adobe Community Professional & MVP
              it does if and only if you use the same target movieclip or _level.