7 Replies Latest reply on Jul 4, 2006 1:03 PM by kglad

    removeMovieClip() problems

      I'm having trouble with removing a movie clip. This is the area of code in question:

      _root.createEmptyMovieClip("ContentContainer", _root.getNextHighestDepth());

      The "ContentContainer" movie clip conains all of the content on the stage with exception of the menu. When you click on a menu button, I want any content cleared and rebuilt. This bit of code works ever-other click. This means that the first click on a menu item will not remove the movie clip and cause everything else to break. By clicking another menu item, the ContentContainer movie clip is removed normally and everything works nicely. Is there perhaps a problem with removing and creating a movie clip with the same name? or does it have to do with waiting for the movie clip to be removed/created before accessing it? Any insight would be greatly appreciated!
        • 1. Re: removeMovieClip() problems
          NewMediaRoc Level 1
          The reason why I'm not using unloadMovie is because for some reason, I can't create the ContentContainer movie clip again when I do this.
          • 2. Re: removeMovieClip() problems
            kglad Adobe Community Professional & MVP
            something other than that code is causing your problem.

            p.s. you can't create (another) _root.ContentContainer when you use unloadMovie() because unloadMovie() doesn't remove _root.ContentContainer: unloadMovie() removes the contents of _root.ContentContainer but not _root.ContentContainer, its properties or its handlers.
            • 3. Re: removeMovieClip() problems
              NewMediaRoc Level 1
              I think it has to do with the components that are within the ContentContainer. When I remove ContentContainer and create a new one when the old and new ones both contained input fields, it works fine, but when I use radio buttons or any other type of component it doesn't work. I've been reading about how certain components are beyond the removable range of depths. When I create them within another movie clip, will they be removed correctly when I remove that new movie clip (if the new movie clip is within the removable range)? Do I have to swap depths for each component within the ContentContainer to remove them?
              • 4. Re: removeMovieClip() problems
                NewMediaRoc Level 1
                PS thanks for the clairification on unloadMovie() I havn't really used it before, and was unsure of its uses.
                • 5. Re: removeMovieClip() problems
                  kglad Adobe Community Professional & MVP
                  there are several badly coded components. among other problems, some place their depth at the highest depth allowed by flash for a removable movieclip (1,048,575).

                  then when you use _root.getNextHighestDepth() to assign a depth to a movieclip that you create (like _root.ContentContainer) that movieclip is placed beyond the range of a removable movieclip. hence, your problem.

                  to remedy, don't use components, don't use _root.getNextHighestDepth() or both. i prefer both.

                  in particular, i find it easier (less typing) and less problematic to use a variable (i use dep) to track the depths i use in flash. i start my projects with dep=0 and everytime i use a depth, i increment dep immediately.
                  • 6. Re: removeMovieClip() problems
                    NewMediaRoc Level 1
                    thats an interesting solution to the depth problem. probably better than using getNextHighestDepth()

                    I found that it is definatly a problem with the components, It took me forever to get the radio buttons working right, and now they're messing everything up. I tried putting them at depths and are removable, but that doesn't work, I just think I"m going to have to make my own radio buttons. Heh, you spend hour and hours trying to make the built in components work, then it turns out that they don't work at all... sweet!

                    thanks for your help kglad
                    • 7. Re: removeMovieClip() problems
                      kglad Adobe Community Professional & MVP
                      yes, that's exactly true about the issues with components. it's always been quicker and easier for me to make my own component than to use a premade one. it's just so hard to get them to "play nice" with the rest of your project and it's so hard to customize them if you want to change their appearance or behavior, even just a little.