3 Replies Latest reply on Sep 25, 2008 8:58 AM by turch2009

    attachMovie issue

    turch2009
      Ok, so I need to attach multiple movieClips inside an existing movieClip on the stage. Right now that movieClip on the stage is empty and void of script. Its instance name is "movieMC". Below I've attached the code I'm using.

      If I don't place the movieClips inside the existing movieClip, it works and pumps out multiple movieClips.
        • 1. Re: attachMovie issue
          Level 7
          Use movieMC.getNextHighestDepth() not this... when you use this, you keep
          getting the same depth, so you only ever see the last one created.

          --
          Dave -
          www.offroadfire.com
          Head Developer
          http://www.blurredistinction.com
          Adobe Community Expert
          http://www.adobe.com/communities/experts/


          • 2. Re: attachMovie issue
            Rothrock Level 5
            That is great. So what is the problem? You tell us what works, but you show us some code which presumably doesn't work?

            If something isn't working, how do you know that it isn't working? What do you see?
            • 3. Re: attachMovie issue
              turch2009 Level 1
              DMennenoh,

              Thank you that did it. I can't believe i didn't see that.

              Rothrock,

              For the benefit of anyone else trying this:
              The problem was that the movieClip being duplicated would only do it once if inside another clip because as DMennenoh pointed out, I was using "this" to get the next highest depth instead of the instance name of the movieClip I was placing it in.

              Here's the fixed code if you want to try it:

              for (j=0; j<4; j++) { movieMC.attachMovie("item","items"+j,movieMC.getNextHighestDepth(),{_x:10, _y:30+70*j});
              }

              this will attach 4 movieClips with the linkage name "items" in a movieClip on the stage named "movieMC".

              Thanks again.