Thanks for your reply Steve. I modified the original class to do exactly what you suggested with such a third parameter. You also mention,
"This was added mainly for the purpose of making it easy to remove event listeners without having to keep an external reference to the delegate functions that were created." Do you have an example of how this might be used? How does the reference to the delegate class itself help allow removal of such event listeners? Or wait--- it's a reference to the function passed in as the second parameter... I'll verify that right now. Jeff. On 7/4/06, Steve Webster <[EMAIL PROTECTED]> wrote:
Hi Jeff, > In the delegate class from Steve Webster, there is this line: > > var fullArgs:Array = arguments.concat(self.extraArgs, [self]); > > I was wondering if anyone knows why there is a reference to self passed to > the handler function. Or how might this be useful? This extra argument could > cause a problem depending upon what your hander function does with > parameters, for example if you have a function with a dynamic number of > variables. Yeah, my Delegate class doesn't work very well for event handlers that expect a variable number of arguments. This has caused us problems in the past, and we have an internal version of this class that allows you to pass a third argument to Delegate.create that prevents the reference to self being added to the arguments list. Let me know if this might be useful for you and I'll dig it out. The reference to self is passed so that you have a clean and easy way to reference the delegate function in the event handler method. This was added mainly for the purpose of making it easy to remove event listeners without having to keep an external reference to the delegate functions that were created. Of course, you could just use arguments.caller, but that's less obvious. Cheers, Steve -- Steve Webster http://dynamicflash.com _______________________________________________ [email protected] 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
_______________________________________________ [email protected] 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

