Hi Alistair,

 

That worked perfectly, cheers!

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Alistair McLeod
Sent: 19 May 2005 12:31
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Event Listeners

 

Hi Michael,

 

I imagine its because your event listener is an anonymous function, so the removeEventListener must be passed a reference to the same function. Try this (untested)

 

 myHandler : Function = Delegate.create( this, handleEvent );

 pane.addEventListener("contentCreated", myHandler );

 

 ...

 

 pane.removeEventListener("contentCreated", myHandler );

 

myHandler may have to be stored asan instance variable if (as I suspect) the add and remove are in different scope.

 

Please let us know if that works.

 

Ali

 

--

Alistair McLeod
Development Director

iteration::two
[EMAIL PROTECTED]

 

Office:  +44 (0)131 338 6108

 

This e-mail and any associated attachments transmitted with it may contain confidential information and must not be copied, or disclosed, or used by anyone other than the intended recipient(s). If you are not the intended recipient(s) please destroy this e-mail, and any copies of it, immediately.
 
Please also note that while software systems have been used to try to ensure that this e-mail has been swept for viruses, iteration::two do not accept responsibility for any damage or loss caused in respect of any viruses transmitted by the e-mail. Please ensure your own checks are carried out before any attachments are opened.

 

 

 


From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Michael Herron
Sent: 19 May 2005 12:18
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Event Listeners

All,

 

I am having a problem with removing event listeners on a panel.

 

I am adding the event listener like so:

 

            pane.addEventListener("contentCreated", Delegate.create(this, handleEvent) );

 

But trying to remove the event listener using removeEventListener does not seem to work. I have tried several variants:

           

            pane.removeEventListener("contentCreated", Delegate.create(this, handleEvent) );

            pane.removeEventListener("contentCreated", Delegate.create(this) );

            pane.removeEventListener("contentCreated", this.handleEvent );

            pane.removeEventListener("contentCreated", this );

 

and none seem to work.  I’ve been struggling with this for a good few hours and its driving me crazy, any help would be appreciated….

 

Ta

Mike Herron

 



Yahoo! Groups Links

Reply via email to