Olivier J.
Olivier J.

Reputation: 3165

FLEX : avoid memory leaks

If in a component I have basic Button which can propagate MouseEvent.CLICK like this :

<s:Button id="btn" click="someFunction(event)" />

Should I manually remove this event if I remove my component with parent.removeElement(myButton) function or is it automatically removed ?

Thanks for clarification

Upvotes: 0

Views: 116

Answers (1)

ketan
ketan

Reputation: 19341

Of course it will automatically removed event once you remove component(Button). There is no need to remove event manually then.

For Timer:

Once you set timer = null it should be ready for garbage collection. In smaller projects in most cases it makes no difference. In bigger one it probably will make difference. But, Personally, In my code, I would still remove the listener.

Upvotes: 1

Related Questions