Edited at

C++でのremoveAllChildrenの実装例

More than 5 years have passed since last update.

vector<flash::DisplayObject*> children;

void DisplayObjectContainer::removeAllChildren() {
int i = 0;
int l = children.size();

DisplayObject* child;
for(i; i < l; i++){
child = children[i];
//ステージとの参照を切る
child->stage(NULL);
//親コンテナとの参照を切る
child->parent(NULL);
//配列から削除
children.erase(children.begin() + i);
--i;
--l;
}
}