4 Replies Latest reply on Dec 20, 2006 10:53 AM by kglad

    attachMovie adds library item twice?

    Andra Veraart
      Hi everyone!

      I've come across this problem for the second time now, and I'm still not sure what solved it the first time.

      I have a timeline that contains the clip "contentMC". On the same timeline the following AS appears:

      _root.contentMC.attachMovie("home", "contentHolder", _root.contentMC.getNextHighestDepth());

      The library item "home" contains several text objects. The strange thing is that, while the item is added as "contentHolder", the contents of "home" is also added to "contentMC". So when I use List Objects during preview, I get:

      Level #0: Frame=24 Label="Interface Build"
      Movie Clip: Frame=1 Target="_level0.contentMC"
      Shape:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:
      Movie Clip: Frame=1 Target="_level0.contentMC.contentHolder"
      Shape:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:
      Text:

      The first row of "Text:" shouldn't be there.

      I came across this problem before at a different level. That one was solved (I think) by replacing .getNextHighestDepth() with 1. This time, however, that doesn't help.
      Anyone any ideas?

      I've uploaded the .fla at: http://www.eurovoice.nl/flash/eurovoice01.fla

      Thanks in advance!

      Yours,
      Andra
        • 1. Re: attachMovie adds library item twice?
          kglad Adobe Community Professional & MVP
          the objects contained by _root.contentMC have nothing to do with "home". in fact, the objects contained by _root.contentMC will be the same whether you remove your attachMovie() statement or not.
          • 2. Re: attachMovie adds library item twice?
            Devendran Level 1
            in this file

            U are calling the attachMovie to atttach Home to contentMC
            But inside the contentMC again you are calling _root.contentMC.contentHolder.attachMovie("homeDiensten", "contentSub", 1);
            We can't expect the attachMovie will attach the MC immediately we have to put some listener to check... (But Actually this wouldn't create the problem u have explained.) Actually u r having Text instances inside the contentMC....
            Please check it
            • 3. Re: attachMovie adds library item twice?
              Andra Veraart Level 1

              I guess I got lost in my own plans for navigation! I completely forgot that the "contentMC" on the timeline was an instance of "home". This caused the textfields to appear there. I've swapped the instance of "home" with an empty movieclip. That solved the problem.
              Thanks kglad, for putting me on the right track.

              Devendran: I haven't had trouble attaching the "homeDiensten" to "home" yet, but I'll run a few online tests and keep an eye out for that possible problem. I do use a preloader at the very beginning of the movie, so all MC's I want to attach should be available without delay.

              If I were to safeguard for this problem, should I do it like this?:
              _root.contentMC.contentHolder.onLoad = function(){
              _root.contentMC.contentHolder.attachMovie("homeDiensten", "contentSub", 1);
              }

              Thanks for your help!

              Yours,
              Andra

              • 4. Re: attachMovie adds library item twice?
                kglad Adobe Community Professional & MVP
                you're welcome.