Game Development Reference
In-Depth Information
Each sprite must have a parent if it is being displayed on the screen. A sprite may
have as many children as needed. The hierarchy of parent-child relations may be
arbitrarily deep.
The hierarchy of the sprites is as follows:
If the previous image shows the ordering of a group of sprites, the following diagram
is an example of how the sprites may be arranged front to back on the screen:
The sprite can be removed from its parent and added as a child of another sprite. In
this case, the children of the sprite that was moved will remain as children and thus
would also be moved effectively along with its parent.
Furthermore, the children are kept in an ordered array. The order in which they are
stored is the same order the sprites are drawn on the stage by the Flash runtime. For
example, the root sprite is drawn first, and then its children are drawn in the order that
they are sorted. The order is controlled by the programmer, as you will see shortly.
 
Search WWH ::




Custom Search