@@ -69,9 +69,28 @@ TestCase {
6969 }
7070
7171
72− // Find an object with the given name recursively, starting
73− // at the given object "obj"
72+ // Find an object with the given name in the children tree of "obj"
7473 function findChild(obj,objectName) {
74+ var childs = new Array(0);
75+ childs.push(obj)
76+ while (childs.length > 0) {
77+ if (childs[0].objectName == objectName) {
78+ return childs[0]
79+ }
80+ for (var i in childs[0].children) {
81+ childs.push(childs[0].children[i])
82+ }
83+ childs.splice(0, 1);
84+ }
85+ return undefined;
86+ }
87+
88+ // Find an object with the given name in the children tree of "obj"
89+ // Including invisible children like animations, timers etc.
90+ // Note: you should use findChild if you're not sure you need this
91+ // as this tree is much bigger and might contain stuff that goes
92+ // away randomly.
93+ function findInvisibleChild(obj,objectName) {
7594 var childs = new Array(0);
7695 childs.push(obj)
7796 while (childs.length > 0) {