PDA

View Full Version : deleting all objects in root


RespeckKnuckles
11-13-2007, 05:18 PM
is there a simple way to remove all the movie clips in the root, besides removeMovieClip() for each one individually?

cmbarsotti
11-13-2007, 08:00 PM
try:

for (var each in _root) {
if (typeof (_root[each]) == "movieclip") {
_root[each].swapDepths(100);
_root[each].removeMovieClip();
_root[each].unload();
}
}

The 100 could be any positive value, all it's doing is moving mcs created in the authoring tool to a positive depth (negative depths don't get deleted)

I use both remove and unload to catch mcs created by duplicate or attach...

Let me know if this does the trick.

RespeckKnuckles
11-13-2007, 11:32 PM
worked perfectly, thanks!