all groups > flash actionscript > june 2005 >
You're in the

flash actionscript

group:

removeMovieClip woes


removeMovieClip woes wiger toods
6/18/2005 10:51:32 PM
flash actionscript:
Hi All. I'm have a problem with removeMovieClip method. It doesn't remove the
movie clip. I read some where else that it won't remove the movie clip if there
is another with the same name or if it's depth is greater than 1.4 million.
I've check and I have no movie clips with the same name and the depth of the
movie clip I am trying to remove is 1048576 (don't know why it is so high, it
is just what getNextHighestDepth() returned).

Does anyone know where there is some documentation on when removeMovieClip
won't actually do it's job?

Thanks
Re: removeMovieClip woes kglad
6/18/2005 11:55:06 PM
lol. you just hit the depth at which dynamic removal of movieclips is
disabled. you can dynamically remove movieclips that have depth from 0 to
1,048,575.

the question is why are you getting such a depth. normally, flash starts at 0
and works its way up. unless you are instantiating over 1 million movieclips,
i don't know any good reason you should be seeing such a large depth.
Re: removeMovieClip woes wiger toods
6/19/2005 12:00:00 AM
Thanks mate. You rock!
It was due to a couple of components I added to my main timeline.
Isn't it bizare that if you add components to your timeline the depth shoots
up. Even more bizare that you can't remove movie clips if their depth gets too
high. How does someone find out these quirky things? Trial and error or is
there a decent help file out there somewhere?


Re: removeMovieClip woes rlc5611
6/19/2005 12:00:00 AM
You can learn more about depths at:

http://www.kirupa.com/developer/actionscript/depths2.htm

As far as the components go, I think that is trial and error. The swapDepths()
thing I mentioned, I have not yet seen anybody else endorse that. It is just
something I have tried and it seems to work. You will find that many people
will not use the Flash UI components because a) they are buggy as you have
begun to find out and b) they have way too much overhead and inflate your file
size far too much for what they actually do. Just not enough bang for the buck.

One other idea that occurred to me: if you like to use loadMovieNum, you could
place all your components in a separate movie and load that movie to its own
level and then just communicate between levels as required. This will keep the
components with all their quirks isolated from the rest of your work and also
help you in terms of preloading if you need to do that. It looks like if you
load components to their own level via loadMovieNum, all the extra classes that
it loads are confined to the _root of that level only.
Re: removeMovieClip woes rlc5611
6/19/2005 12:19:03 AM
If you are using UI components, they place two or more movie clips at depths of
1048574 and 1048575 and then, if you use getNextHighestDepth() (in the _root
timeline), well, there you go. you just hit 1048576 and it is not removable. My
suggestion is to use swapdepths to move those very high movie clips down to
more reasonable depths so that getNextHighestDepth will work correctly or else
make an empty clip holder and create all your dynamic clips inside the clip
holder. This problem between UI components and getNextHighestDepth will only
occur in the _root timeline even if the UI components are nested inside movie
clips.

Just as an example, you can use:

focusManager.swapDepths(-3141);
reserved.swapDepths(-3142);

I am not sure what else you have way up there because it might depend on which
UI components you are using but I don't know for sure since I don't use
components any more but it is easy enough to find out.

for(thingy in _root) {
if(typeof(_root[thingy]) == "movieclip") {
trace("hi my name is " + thingy + " and my depth is " +
_root[thingy].getDepth());
}
}
AddThis Social Bookmark Button