Hi, first of all very good work very appreciate here.
I've only one question:
I've noticed one error in MM Delegate class.
When I add an eventlistener to an object using Delegate, i can't remove it.
It seems that the problem happens also with your libs.
The problem, I think, is in line 65 of ArrayUtils .
Due to MM allocation system doing Delegate two times doesn't return the same value.
So "if(arr[i] == obj){" is always false for funcion added with Delegate.
If I can suggest a solution, I've modified the removeEventListene r as follows:
-----------------------------------------------------------------------------------------------
//trace ("removing "+(o.func == handler))
// if the function is equal or the function is a delegate of the
//same function
var eval = ((o.func) == (handler.func)&&(o.target == handler.target));
if (o == handler || eval ) {
queue.splice(i, 1);
return;
}
------------------------------------------------------------------------------------------------
Where
o = arr[i]
handler = obj
in your function.
But I don't use an external ArrayUtils class, so I don't know if you can use this hint
Hope this helps,
thanks for the good work
Marco
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Welcome to Open Discussion
Hi, first of all very good work very appreciate here.
I've only one question:
I've noticed one error in MM Delegate class.
When I add an eventlistener to an object using Delegate, i can't remove it.
It seems that the problem happens also with your libs.
The problem, I think, is in line 65 of ArrayUtils .
Due to MM allocation system doing Delegate two times doesn't return the same value.
So "if(arr[i] == obj){" is always false for funcion added with Delegate.
If I can suggest a solution, I've modified the removeEventListene r as follows:
-----------------------------------------------------------------------------------------------
//trace ("removing "+(o.func == handler))
// if the function is equal or the function is a delegate of the
//same function
var eval = ((o.func) == (handler.func)&&(o.target == handler.target));
if (o == handler || eval ) {
queue.splice(i, 1);
return;
}
------------------------------------------------------------------------------------------------
Where
o = arr[i]
handler = obj
in your function.
But I don't use an external ArrayUtils class, so I don't know if you can use this hint
Hope this helps,
thanks for the good work
Marco
Thanx for your responses:)
In fact there is a way to remove the listeners what ever way you added:
var theListener:Object = xxx.addEventListener(xxx,xxx,xxx);
to remove it with:
xxx.removeEventListener(theListener);
you can see the details about EventDispatcher here:
http://www.aswing.org/aswing-doc/frameset.html