10 Replies Latest reply on Sep 27, 2006 8:14 AM by GellyBean

    Removing MovieClip Problems

    GellyBean Level 1
      I have a Movie Clip with a button (thumb picture) (btnX) which opens another Movie Clip (mc_window1*)(Large Picture), but the button to remove the MC (Large Picture) doesn't work. I have previously tried it in other files and it has worked well. I don't know why this is happening in this one. Is it because it's a MC within a MC?

      btnX. onRelease = function() {
      var mc = attachMovie("mc_window1", "v", 2)
      mc._x= 300
      mc._y= 200
      }



      Button script:

      on(release){
      _root.v.removeMovieClip()
      }



      *mc_window1 it's linkaged

      Thanks again!!
        • 1. Re: Removing MovieClip Problems
          injpix Level 3
          Yeah, it’s probably not working because you nested a MC into another.
          Try the follow code for your “Button script”;

          on(release){
          this._parent.removeMovieClip();
          }
          • 2. Re: Removing MovieClip Problems
            GellyBean Level 1
            Sorry, MyIP
            I have tried your code already and the MC still there. Any other suggestions?

            on(release){
            this._parent.removeMovieClip();
            }
            • 3. Re: Removing MovieClip Problems
              injpix Level 3
              You mentioned, “it's a MC within a MC”. From what you have mentioned and the code posted, I do not believe you are nesting a movieclip into another. All 3 (btnX, button to delete the attached movieclip and the content that got attached to the stage) movieclips are on the _root. So to clarify;

              You do have a movieclip (btnX) on the main stage that has code on the main timeline?
              You also have another movieclip that’s on the main stage with code on it?

              Are you using scenes in this Flash file?
              Using the Debugger will reveal the movieclip hierarchy. I hope this helps.
              • 4. Removing MovieClip Problems
                GellyBean Level 1
                I am only workig with 1 scene.

                In that scene, I am calling a MC (page 1). In that MC (page 1) I have a BUTTON (that is a thumbnail). When you click on the thumbnail, it pops up the full graphic (mc_window1). This grafic contains a button (the X button) that when clicked, should close that graphic (mc_window1). It is not closing.

                I have tried your suggestion, amongst other things, and nothing works.
                • 5. Re: Removing MovieClip Problems
                  injpix Level 3
                  I still don’t understand why the first code I posted doesn’t work. However lets try this, put the following code;

                  trace(this)

                  …in the following 3 places;

                  btnX. onRelease = function() {
                  trace(this)
                  var mc = attachMovie("mc_window1", "v", 2)
                  mc._x= 300
                  mc._y= 200
                  }

                  on(release){
                  trace(this)
                  _root.v.removeMovieClip()
                  }

                  …and put this trace statement in mc_window1’s timeline.

                  Then post the output messages for we can see.
                  • 6. Re: Removing MovieClip Problems
                    GellyBean Level 1
                    MyIP...

                    I'm sorry for bothering you so much. I am noticing that I have much to learn. Here is the problem that has me stuck all day:

                    1- I went to the example that I kept on "the button that removes the MC". The example (the buttons) are in scene 1, main stage. Everything works fine.

                    2- I took the 3 examples that I had on the main stange and I placed them in an independent MC. When clicking, they all appear in the MC call, but none of them close. It seems like the world changes when taking tem to an MC.

                    I have tried to resolve this problem every way I can think of and I can't get to fixing it.

                    Thanks for your assistance!
                    • 7. Re: Removing MovieClip Problems
                      coldMiner Level 1

                      var btnx_mc:MovieClip;
                      btnX.onRelease = function() {
                      btnx_mc= this.attachMovie("mc_window1", "v", 2);
                      btnx_mc._x= 300;
                      btnx_mc._y= 200;
                      }
                      myButton.onRelease = function(){
                      btnx_mc.removeMovieClip();
                      };

                      // replace your direct code on the button with the onRelease code over
                      • 8. Removing MovieClip Problems
                        GellyBean Level 1
                        ...nothing works. Any other suggestions?
                        • 9. Re: Removing MovieClip Problems
                          GellyBean Level 1
                          quote:

                          Originally posted by: myIP
                          I still don’t understand why the first code I posted doesn’t work. However lets try this, put the following code;

                          trace(this)

                          …in the following 3 places;

                          btnX. onRelease = function() {
                          trace(this)
                          var mc = attachMovie("mc_window1", "v", 2)
                          mc._x= 300
                          mc._y= 200
                          }

                          on(release){
                          trace(this)
                          _root.v.removeMovieClip()
                          }

                          …and put this trace statement in mc_window1’s timeline.

                          Then post the output messages for we can see.



                          1
                          _level0.mc1.instance29.boton1

                          • 10. Re: Removing MovieClip Problems
                            GellyBean Level 1
                            Here is the Code!

                            on(release){
                            _parent.v.removeMovieClip()
                            }