Trevor Harrison
01-10-2005, 05:40 PM
I recently saw a ref. here in the forums to the mx.utils.Delegate class.
I have been doing this with my own home-made code like this:
static function makeCallback(obj : Object, func : Function) : Function
{
return function() { return func.apply(obj, arguments); };
}
whereas the macromedia code does it a little different where it creates the func, sets the target and func attributes, and then inside the func uses the arguments param to get the target and func attributes.
On the surface, my stuff is certainly smaller source-code wise, so that make me wonder what MM was doing with their code. Does mine hold some extra stuff in memory that theirs doesn't?
Anyone care to venture a guess?
-Trevor
I have been doing this with my own home-made code like this:
static function makeCallback(obj : Object, func : Function) : Function
{
return function() { return func.apply(obj, arguments); };
}
whereas the macromedia code does it a little different where it creates the func, sets the target and func attributes, and then inside the func uses the arguments param to get the target and func attributes.
On the surface, my stuff is certainly smaller source-code wise, so that make me wonder what MM was doing with their code. Does mine hold some extra stuff in memory that theirs doesn't?
Anyone care to venture a guess?
-Trevor