How can I set the z-index of EaselJS Graphics and Shapes

RobotEyes picture RobotEyes · Feb 19, 2013 · Viewed 18.3k times · Source

I have EaselJS Shapes on the canvas and then I start drawing Graphics each tick. At the moment the graphics are being drawn over the Shapes. Is there a way to define the z-index so that the Shapes are drawn over the Graphics each frame?

Any help would be much appreciated.

Answer

stot picture stot · Dec 17, 2014

To bring an DisplayObject to front after insertion just use this:

stage.setChildIndex( displayObject, stage.getNumChildren()-1);