pixi.js
    Preparing search index...

    Interface FindMixinAdvanced

    The FindMixin interface provides methods for finding children within a container by their label. It allows for searching for a single child or multiple children with a specific label, either directly or recursively through the container's hierarchy.

    interface FindMixin {
        label: string;
        name: string;
        getChildByLabel(
            label: string | RegExp,
            deep?: boolean,
        ): Container<ContainerChild>;
        getChildByName(
            label: string | RegExp,
            deep?: boolean,
        ): Container<ContainerChild>;
        getChildrenByLabel(
            label: string | RegExp,
            deep?: boolean,
            out?: Container<ContainerChild>[],
        ): Container<ContainerChild>[];
    }

    Hierarchy

    Index

    Properties

    label: string

    The instance label of the object.

    null
    
    name: string

    The instance name of the object.

    since 8.0.0

    Container#label

    null
    

    Methods

    • Returns the first child in the container with the specified label. Recursive searches are done in a pre-order traversal.

      Parameters

      • label: string | RegExp

        Instance label to search for

      • Optionaldeep: boolean

        Whether to search recursively through children

      Returns Container<ContainerChild>

      The first child with the specified label, or null if none found

      // Basic label search
      const child = container.getChildByLabel('player');

      // Search with regular expression
      const enemy = container.getChildByLabel(/enemy-\d+/);

      // Deep search through children
      const deepChild = container.getChildByLabel('powerup', true);
    • Parameters

      • label: string | RegExp

        Instance name.

      • Optionaldeep: boolean

        Whether to search recursively

      Returns Container<ContainerChild>

      The child with the specified name.

      since 8.0.0

      Container#getChildByLabel

    • Returns all children in the container with the specified label. Recursive searches are done in a pre-order traversal.

      Parameters

      • label: string | RegExp

        Instance label to search for

      • Optionaldeep: boolean

        Whether to search recursively through children

      • Optionalout: Container<ContainerChild>[]

        Optional array to store matching children in

      Returns Container<ContainerChild>[]

      An array of children with the specified label

      // Basic label search
      const enemies = container.getChildrenByLabel('enemy');
      // Search with regular expression
      const powerups = container.getChildrenByLabel(/powerup-\d+/);
      // Deep search with collection
      const buttons = [];
      container.getChildrenByLabel('button', true, buttons);