On Tuesday 23 Sep 2008, ozziegt wrote:
I have been using creationComplete, but there is no way for me to
remove the listeners when the object is removed from the stage, which
leads to memory leaks.
Does 'remove' not do that ?
--
Tom Chiverton
Helping to biannually compete 24/7 magnetic
All objects dispatch FlexEvent.Remove when they are removed from a
container - this occurs on the stage and also
in Container objects (since Container and Stage both exhibit the same
behaviour).
The FlexEvent.Remove is a way of trapping the message that an object
is being removed by its
Event.REMOVED
Containers cannot use this since their child list is not updated.
UIComponent listens to the Event.REMOVED and stops propagation of it so
there is no way to listen for it. The component will then dispatch
FlexEvent.REMOVE at the correct time after child lists are correctly
On Monday 22 Sep 2008, ozziegt wrote:
I am using the event so the MXML component knows when it has been
added to the stage, and also removed so it can set up and tear down
some event listeners appropriately.
I normally use creationComplete for setting up the listeners.
--
Tom Chiverton
Use Event.ADDED_TO_STAGE instead of creation-complete - you can also
use init to construct listeners in the MXML although i
have seen in the past this occasionally gets messy.
The reason behind this is that after the first hit of the event, you
dont want it to occur again - in the MXML
--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED]
wrote:
I normally use creationComplete for setting up the listeners.
I have been using creationComplete, but there is no way for me to
remove the listeners when the object is removed from the stage, which
leads to memory
Ok - i did a bit of research
you can do the following - trap for the notification FlexEvent.Remove
which occurs when a child is removed
from a container. Other than that im not sure what else to do..
Basically trap this function... my own code already did something
similar but this
All,
Heres a little bit of code i knocked up to demonstrate For MXML -
just extend the class and tie into the functions via the override.
On another note, you might want to check if the current object
contains children - if so remove them before you remove yourself (via
the
I am using the event so the MXML component knows when it has been
added to the stage, and also removed so it can set up and tear down
some event listeners appropriately. Perhaps this isn't the best way to
do it. If another way is better, I'm open to hear it. :)
Yes the currentTarget is the same
9 matches
Mail list logo