I’m always trying to empty out a clip and this is by far the best way :
while (target_mc.numChildren) {
target_mc.removeChildAt(0);
}
or if you prefer to be verbose :
var total:uint = target_mc.numChildren;
for (var i:uint = 0; i < total; i++) {
target_mc.removeChildAt(0);
}
or if you prefer single function :
for (var i:uint = 0; i < target_mc.numChildren; i++) {
target_mc.removeChildAt(0);
i--;
}
Here is a user submitted version :
while (target_mc.numChildren > 0) {
target_mc.removeChildAt(target_mc.numChildren - 1);
}
Here is a one line version :
while (target_mc.numChildren != 0) target_mc.removeChildAt(0);
I think that’s it.
You’re brilliant!
That is some slick code.