Z-index and depth management in Flixel

I'm doing a quick Flixel project in my free time and ran into an issue of depth management. Since flixel essentially just draws a bunch of bitmaps onto the screen, rather than adding children to the display list, it's not as easy as getChildIndex.

It's pretty easy though. In my GameState, which extends FlxState, I access the defaultGroup property. The defaultGroup property is a normal FlxGroup that all children get popped into when calling the add method in FlxState.

I used

CODE:
  1. defaultGroup.members.sortOn("y", Array.NUMERIC);

to sort my display list. I wanted things closer to the bottom to be on top, referencing the sortOn description in Adobe will allow you to extend the functionality of that snippet.