Tuesday, December 18, 2007

remove all movieclips from a container in actionscript


Container = _root;
for (obj in Container)
{
trace("Type:" + typeof(Container[obj]));

if (typeof(Container[obj])=="movieclip")
{
trace("Name:" + Container[obj]._name);
Container[obj].removeMovieClip();//for attached instances
unloadMovie(Container[obj]);//for loaded instances

if(Container == _root)

MC.removeMovieClip();
}
}

No comments: