The Display List

Starling follows the same rule as the native Flash display list (i.e., the stage is not available until objects are added to the display list). To access the stage safely, we usually rely on some of the most important events in Flash, which are also available in Starling:

Event.ADDED

The object was added to a parent.

Event.ADDED_TO_STAGE

The object was added to a parent that is connected to the stage, thus becoming visible now.

Event.REMOVED

The object was removed from a parent.

Event.REMOVED_FROM_STAGE

The object was removed from a parent that is connected to the stage, thus becoming invisible.

We will actively rely on those events in the following examples. Just like any Flash content, those events will allow us to initialize or deactivate objects and optimize performance and resources.

Here is the list of methods defined by the DisplayObject class:

removeFromParent

Removes the object from its parent, if it has one.

getTransformationMatrixToSpace

Creates a matrix that represents the transformation from the local coordinate system to another.

getBounds

Returns a rectangle that completely encloses the object as it appears in another coordinate system.

hitTestPoint

Returns the object that is found topmost on a point in local coordinates, or nil if the test fails.

globalToLocal

Transforms a point from global (stage) coordinates to the local coordinate system.

localToGlobal

Transforms a point from the local coordinate system to global (stage) coordinates.

Here is a list of the properties ...

Get Introducing Starling now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.