Newer
Older
pixi.js / src / extras / getChildByName.js
@dolow dolow on 5 Jan 2018 661 bytes fixed jsdoc annotations (#4577)
import * as core from '../core';

/**
 * The instance name of the object.
 *
 * @memberof PIXI.DisplayObject#
 * @member {string} name
 */
core.DisplayObject.prototype.name = null;

/**
 * Returns the display object in the container
 *
 * @method getChildByName
 * @memberof PIXI.Container#
 * @param {string} name - instance name
 * @return {PIXI.DisplayObject} The child with the specified name.
 */
core.Container.prototype.getChildByName = function getChildByName(name)
{
    for (let i = 0; i < this.children.length; i++)
    {
        if (this.children[i].name === name)
        {
            return this.children[i];
        }
    }

    return null;
};