all groups > flash actionscript > july 2006 >
You're in the

flash actionscript

group:

removeMovieClip() problems



removeMovieClip() problems NewMediaRoc
7/3/2006 11:25:30 PM
flash actionscript: I'm having trouble with removing a movie clip. This is the area of code in
question:

_root.ContentContainer.swapDepths(0);
removeMovieClip(_root.ContentContainer);
_root.createEmptyMovieClip("ContentContainer", _root.getNextHighestDepth());
buildQuestion(questionNum);

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!
Re: removeMovieClip() problems NewMediaRoc
7/3/2006 11:27:52 PM
Re: removeMovieClip() problems kglad
7/3/2006 11:59:28 PM
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.
Re: removeMovieClip() problems NewMediaRoc
7/4/2006 4:13:32 PM
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?
Re: removeMovieClip() problems NewMediaRoc
7/4/2006 4:14:32 PM
Re: removeMovieClip() problems kglad
7/4/2006 4:27:30 PM
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.
Re: removeMovieClip() problems NewMediaRoc
7/4/2006 6:21:52 PM
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
Re: removeMovieClip() problems kglad
7/4/2006 8:03:26 PM
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.
AddThis Social Bookmark Button