@Stein Gauslaa Strindhaug
这很粗糙,但它应该可以解决问题!
private function traceAllChildren(rootContainer:DisplayObjectContainer):void {
for(var i=0; i < rootContainer.numChildren; i++) {
var item:* = rootContainer.getChildAt(i);
try {
traceAllChildren(item);
} catch (e:Error) {
trace(e.toString());
}
trace(item.toString());
// This is the block where you can affect
// an 'item' depending on it's type, name, etc..
// eg:
// if (item.toString() == '[object TextField]') {
// item.text = "The text I want to insert";
// }
// or
// if (item.name == myTextFieldNameVar) {
// item.text = "The text I want to insert";
// }
}
}
然后像这样调用它:traceAllChildren(this) 或 traceAllChildren(myParentMovieClip)。
我希望这会有所帮助,祝你好运!