CAAT.Foundation.ActorContainer

Z Indexing child Actors

Every container, sets Z Index values so that the first added actor is below the others, and the last one on top of every one.

This natural z index can be modified by calling container's method setZOrder(actor, zindex).

The parameter 'actor' is an actor held by the container, and the zindex is the new zindex position to set the actor at. if zindex is Number.MAX_VALUE, (or simply greated that container's actor count) the actor will be above every other actor of this container.

Retrieving Actors

Functions to retrieve elements inside a container are:

  • getChildAt(number) => Actor: retrieve the nth element.
  • findChild(actor) => number: retrieve the position of an actor. -1 if not found.
  • findActorById(id) => Actor: retrieve the actor with given id. null if not found.
  • findActorByPosition( CAAT.Math.Point ) => Actor: retrieve the actor at a given coordinate in the container. returns the container itself if there's nothing at that coordinate.

Removing Actors

Functions to remove actors are:

  • removeChildAt(number) => Actor: remove and return the nth Actor.
  • removeChild(actor) => Actor: remove actor from this container.
  • removeFirstChild() => Actor: remove first actor (smallest zIndex).
  • removeLastChild() => Actor: remove last actor (biggest zIndex).