getChildByName method

  1. @override
DisplayObject getChildByName (
  1. String name

Returns the child DisplayObject that exists with the specified name.

If more that one child DisplayObject has the specified name, the method returns the first object in the child list.

The getChildAt method is faster than the getChildByName method. The getChildAt method accesses a child from a cached array, whereas the getChildByName method has to traverse a list to access a child.


DisplayObject getChildByName(String name) {
  for (var i = 0; i < _children.length; i++) {
    var child = _children[i];
    if ( == name) return child;
  return null;