5 Replies Latest reply on Apr 7, 2008 11:36 AM by kglad

    nested MCs don't work

    jj_no
      This is my graphics portfolio. It will go on my Web portfolio site.

      In Flash 8, AS2

      I have a graphic portfolio that shows my Web work and other categories. The whole parent file will live on my Web portfolio.

      The Parent/Child hierarchy of nested MCs will be 2-3 levels deep depending on weather an example has one image, or a multi-image gallery.

      Problems:
      ___________________

      - Everything works fine when you preview each level of MC alone, however, it blows up when you use them in the Parent (Work Sections). Again, Web4 is the link in question
      - paths are not resolved (the external Children SWFs do not load into levels up the hierarchy
      - buttons in Children to not work in the Parent
      - Key events DO work, but the rest of the positioning portions of that script do NOT - the photos do not stop at the beginning or the end, they just keep marching on and disappear

      Areas to learn:
      - I have some depreciated code in here (like tellTarget), but should be no big deal
      - I probably need assistance with pathing
      - I probably need assistance with where the code needs to go (local to the Child objects and frames), or global on the Parent's
      - getting buttons and other local code to work

      Posting code snippets won't cut it, so I'll link to a ZIP of the whole project in my FTP area (Zip contents: FLAs, SWFs, graphic files, RTF documentation file, PDF of directory structure).

      link: http://www.jfxstudio.com/clients/flash/adobeforum/Flash_nested_mc_problems.zip

      login: User AND Pass = "flash" (sorry to have to use this)

      I've been all through my books and various searches and Web forums. If someone could give me an uncomplicated peek at how this stuff works, I could take it from there. I've recently bitten the bullet and learned Flash in a systematic way. Beyond the basics, I'm still an AS hacker. This has turned into an arduous task.

      Thank you for any help you are able to provide!

      - Joe
        • 1. Re: nested MCs don't work
          Level 7
          I doubt you'll get many people to download a zip for you... but I'll say
          this, it sounds like a standard beginner problem of using _root references
          in your clips. When a clip loads another clip, root changes. It's best to
          just not use it ever. It's much better to store a referece to 'this', and
          use it. Or use the hierarchy but avoid _root - use this._parent, etc.
          Another suggestion is to use a singleton helper/utility class. Instantiate
          it in your main 'nav' movie, and store a ref to that movie in the class.
          Other movies can then get an instance of the singleton and use the stored
          reference.


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


          • 2. Re: nested MCs don't work
            jj_no Level 1
            Thanks for the reply.

            Yeah, I know the ZIP is a stretch, but merely pasting code probably won't cut it....

            I've looked for some Singleton info, and I'll follow up on that to gain knowledge. That's a new concept to me. Any easily understood tutorials or sources on this, or on hierarchies and pathing that you recommend?

            Thanks!
            • 3. Re: nested MCs don't work
              kglad Adobe Community Professional & MVP
              you can try adding

              this._lockroot = true;

              in your swfs that load into your main swf. that has a fair chance of solving your problems.
              • 4. Re: nested MCs don't work
                jj_no Level 1
                kglad -

                Alright!

                It works now - I just had to resolve the pathing of my external graphics to "Parent", not the various "Children," but "lockroot" kept the scripting working in each Child. :-)

                I had hoped for all of the external links for graphics and other linked children to be local for each Child where they are called, but alas "no" (for the moment). It won't kill me on this small project.

                I know, 'don't use _root.' These portfolio galleries are not really that dificult to do - once I get one working. I can just pour the actual graphics in. For now, I just want this thing to work. In the near-future, I need to learn AS better and become a more hygenic programmer (like I am with HTML, CSS, etc.)!

                I guess I'm not far enough along to use the Singleton method, or to understand what some of its detractors are talking about. It looks kind of scary to my neophyte eyes. :-)

                Thanks for your help guys.

                -Joe
                • 5. Re: nested MCs don't work
                  kglad Adobe Community Professional & MVP
                  you're welcome.