1 Reply Latest reply on Nov 26, 2009 4:29 AM by Ned Murphy

    2 x remove/attach mc in one rollOver event doesn't work

    NeronBurningRome

      Hi,

       

      I'm using removeMovieClip and AttachMovie twice in one rollOver event, but only the second one works. Here's the code:

       

      on (rollOver) {
          removeMovieClip ("LetP");
          attachMovie ("LetPi", "LetPi", i);
          LetPi = eval ("LetPi");
          LetPi._x = 70;
          LetPi._y = 0;
          removeMovieClip ("k");
          attachMovie ("ki", "ki", i);
          ki = eval ("ki");
          ki._x = 170;
          ki._y = 100;
          }

       

      So - if there is only remove/attach of "LetP" everything works fine, but whene I add ramove/attach "k" only the "k" works, the "LetP" doesn't change.

      Should I put it into a function? Or is there another reason?

       

      Actually I just checked and the removeMovieClip doesn't work in both cases. Is that becouse actionscript is attached to object itself instead of a dedicated actionscript layer?

        • 1. Re: 2 x remove/attach mc in one rollOver event doesn't work
          Ned Murphy Adobe Community Professional & MVP

          The help documentation explains the limitations of removeMovieClip.  The latter part of this probably applies in your case:

           

          "Removes a movie clip instance created with duplicateMovieClip(), MovieClip.duplicateMovieClip(), MovieClip.createEmptyMovieClip(), or MovieClip.attachMovie().

           

          This method does not remove a movie clip assigned to a negative depth value. Movie clips created in the authoring tool are assigned negative depth values by default. To remove a movie clip that is assigned to a negative depth value, first use the MovieClip.swapDepths() method to move the movie clip to a positive depth value."