InvokeAdded() private method

private InvokeAdded ( DisplayObject target, DisplayObject currentTarget ) : void
target DisplayObject
currentTarget DisplayObject
return void
示例#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);
            }
        }
        /// <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)
            {
                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); 
            }
        }