I don't know what does your utils.Proxy.create() method do exactly,
but mx.utils.Delegate.create() always returns a new Function instance,
thus it cannot be used directly in removeEventListener() calls. Store
the function reference passed to addEventListener and use it in
removeEventListener(), too:

myEventHandler = mx.utils.Delegate.create(this, onMyEvent);
foo.addEventListener('myEvent', myEventHandler);

...

foo.removeEventListener('myEvent', myEventHandler);

If your Proxy class takes care about always returning the same
Function instance for the same arguments (I doubt it), then you can
use it as you wrote.

  Attila

JHdo> I was wondering if I am doing something correctly when adding listeners
JHdo> to objects. My question is, if I remove the listener is the code below 
JHdo> then the right way. Do I use the Proxy class (or mx.utils.Delegate) also 
JHdo> when I remove the listener??
JHdo> 
JHdo> //adding a listener
JHdo> this.currentDisplayObject.addEventListener('onContentCleared' , 
JHdo> utils.Proxy.create(this ,  onBlockContentDestoyed , 'text ' , url))
JHdo> 
JHdo> //removing it
JHdo> this.currentDisplayObject.removeEventListener('onContentCleared' , 
JHdo> utils.Proxy.create(this ,  onBlockContentDestoyed))


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to