Search code examples
animationcanvasvector-graphicseaseljscreatejs

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


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.


Solution

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

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