Sparrow.Display.DisplayObject.RemoveFromParent C# (CSharp) Méthode

RemoveFromParent() public méthode

Removes the object from its parent, if it has one.
public RemoveFromParent ( ) : void
Résultat void
        public void RemoveFromParent()
        {
            if (Parent != null)
            {
                Parent.RemoveChild(this);
            }
        }

Usage Example

Exemple #1
0
        /// <summary>
        /// Adds a child to the container at a certain index.
        /// </summary>
        public void AddChild(DisplayObject child, int index)
        {
            if (index >= 0 && index <= _children.Count)
            {
                SetRequiresRedraw();

                if (child.Parent == this)
                {
                    SetChildIndex(child, index); // avoids dispatching events
                }
                else
                {
                    child.RemoveFromParent();
                    _children.Insert(index, child);
                    child.Parent = this;

                    child.InvokeAdded(child, this);
                    if (Stage != null)
                    {
                        child.BroadcastAddedToStageEvent(this);
                    }
                }
            }
            else
            {
                throw new IndexOutOfRangeException("Invalid child index " + index);
            }
        }
All Usage Examples Of Sparrow.Display.DisplayObject::RemoveFromParent