Yes, the cell renderers will be zombied, sort of.  It’s not actually truly zombied because we recycle thecell renderers.  When a row isn’t needed due to resizing or whatever it goes on a free list, when it’s needed we’ll bring it back.  What I don’t remember off-hand is if we do decide to clear the free list if we go through and actually remove the MovieClip.  I think it becomes moot if we do that since the Player will destroy the object.  Though there will be dangling references to undefined I think, but at least you won’t have lots of code executing that you don’t want.

 

Matt

 


From: Dirk Eismann [mailto:[EMAIL PROTECTED]
Sent: Friday, February 25, 2005 12:37 AM
To: [EMAIL PROTECTED]
Subject: RE: [flexcoders] Removing the Event listener...

 

Btw, I always wondered if references to listeners will get removed automatically.

 

For example, a List control myList is using a custom cellrenderer. The cellrenderer instance registers itself with another componentby doing

 

  listOwner.addEventlistener("change", this)

 

now if there were 10 visible rows in the List then there would be 10 listeners (references) added to myList. What happens if I do myList.removeAll()? Will there be "zombie" references to the cell renderer instances because they are still stored inside the array of listeners for the List control?

 

Thanks,

Dirk.

 

 

 -----Original Message-----
From: Matt Chotin [mailto:[EMAIL PROTECTED]
Sent: Friday, February 25, 2005 7:39 AM
To: [EMAIL PROTECTED]
Subject: RE: [flexcoders] Removing the Event listener...

Hmm, I think it’s probably harder to do this straight from the tag.  You may need to set this up differently.

 

<mx:Script>

  var funcToRemove : Function;

 

  function addListener()

  {

    funcToRemove = mx.utils.Delegate(this, remEvent);

    btn.addEventListener(“click”, funcToRemove);

  }

 

  Function remEvent()

  {

    Btn.removeEventListener(“click”, funcToRemove);

  }

</mx:Script>

 

<mx:Button id=”btn” initialize=”addListener()” />

 

No idea if this works, but should giveyou the idea.  If the Delegates don’t work you may need to use a listener object instead of passing in a straight function.  I think we discuss listener objects in the docs.

 

Matt

 


From: anumathew76 [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 24,2005 10:21 PM
To: [EMAIL PROTECTED]
Subject: [flexcoders] Removing the Event listener...

 


Hi,
I want to remove an event associated to a component. I have a button

<mx:Button id="btn" label="RemEvent" click="remEvent()" /> I want to
remove the click event handler for the button
I tried btn.removeEventListener("click",remEvent). It doesn't seem
to be working.Please advise me.
Thanks,
Anu




 



Reply via email to