Publishers of technology books, eBooks, and videos for creative people

Home > Articles > Web Design & Development > ActionScript

  • Print
  • + Share This
From the author of

Controlling the z-index of display objects

Problem: Depth doesn’t exist in ActionScript 3, which means that the swapDepths and getNextHighestDepth methods can no longer be used to change the z-axis of a display object.

Solution: Controlling the z-axis and finding the highest z-index is possible. Since display objects reside on the display list, the syntax reflects the new architecture.

Code: setChildIndex is an inherent display object method that can be used to set the z-axis index of child display objects. The numChildren property is an inherent display object property that can be used to determine the highest z-axis index in the current display list.

this.setChildIndex(this.currentDraggable, this.numChildren-1);
  • + Share This
  • 🔖 Save To Your Account