Sorry if this seems like a silly question, but here goes.
I'm adding a degrafa graphic to a generic flex button. My assumption was that when I addChild, since it is the last child in the display list, that it would automatically be on top. However, it seems to be underneath the rounded rectangle and label of the button.
I've tried invalidateDisplayList(), but to no avail. Any info would be greatly appreciated.
The overall goal is to add a red circle to the button with the number of new notifications. Like in this image: http://supportforums.blackberry.com/t5/image/serverpage/image-id/7985i8778C090B0C8A130/ima ge-size/original?v=mpbl-1&px=-1
Yes, I do know I can make a unique button/image class and do this, but I'd like to know the answer to this layering question.
Adding children to a component that does not expect children is unreliable at best. Most components have internal code that modify the display list. Implementing a hack to get this unexpected behavior to "work" is ill advised. Spark skinning is the way to go here, or if you're still in Flex 3, wrap your button in a custom UIComponent class and add the logic needed for positioning the graphic on top of the button.