I'm trying to write a listener that gets triggered when an element is added to a Spark Container. I just noticed that for a Spark Group container if I register a listener for the elementAdd/elementRemove events (ElementExistenceEvent.ELEMENT_ADD/ElementExistenceEvent.ELEMENT_REMOVE), the same event gets fired if I change the depth order of the elements in the Group using setElementIndex (E.g. to bring one component on top of the other). Is there a way to know when an element gets added for the first time (i.e. excluding the index re-ordering?). Per the documentation elementAdd should work for this.
The documentation for elementAdd says.
Dispatched when a visual element is added to the content holder. event.element is the visual element that was added.