Skip navigation
Purushotham Nayak
Currently Being Moderated

Spark Containers elementAdd event and setElementIndex

Nov 17, 2012 7:32 PM

Tags: #flex #spark #containers

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_REMO VE), 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.

However this page says

Spark containers dispatch multiple itemAdd and itemRemove events.

I couldn't find itemAdd/itemRemove anywhere in the reference. The setElementIndex reference doesn't say anything about add/remove events getting fired.

 

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points