$setParent method

void $setParent(
  1. GDisplayObjectContainer? value
)

(Internal usage) Sets the GDisplayObjectContainer that contains this GDisplayObject.

Implementation

void $setParent(GDisplayObjectContainer? value) {
  var ancestor = value;
  while (ancestor != this && ancestor != null) {
    ancestor = ancestor.$parent;
  }
  if (ancestor == this) {
    throw ArgumentError(
        'An object cannot be added as a child to itself or one '
        'of its children (or children\'s children, etc.)');
  } else {
    $parent = value;
  }
}